Skip to content

Client Unauthorized Error #81

@tynes

Description

@tynes

There exists a condition in which a bug can happen here:
https://github.com/bpanel-org/bpanel/blob/development/server/bcoinRouter.js#L24

If the request times out on the back end, the token is not reset
For the wallet, we could do something like:

let wallet = client.wallet(id, token)
wallet.request(...)

But that wouldn't work with the node client, as it wouldn't have a wallet method.
Maybe we can create a new and temporary client with something like:

// inject(Client)
let newclient = client.inject(client)
newclient.token = token
newclient.request(...)

or

// inject(Client, opts {})
let specialized = client.inject(client, { id, token })
// returns client.wallet() or client.node()
// that comes from a new client instance

Maybe inject is a static method that returns a new instance of the client?
Would have to reference client.prototype to be able to reach the method then I believe

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions