BitPay Node.JS Client error interacting with BTCPayServer "no-bitid"
See original GitHub issueI’ve successfully paired the Bitpay Node.JS client with my local instance of BTCPayServer, but when i try to invoke the api i’m getting this weird “no-bitid” error.
root@ubuntu:/home/ubuntu/node_modules/bitpay/lib# bitpay pair
Do you have a pairing code?
no
Okay, we can get a pairing code, please choose a facade:
1) Point of Sale
2) Merchant
: 1
Your token information:
Client ID: Tf71..................................ZYR3
Pairing Code: zEXgMr5
Label: node-bitpay-client-ubuntu
Facade: pos
Your pairing code will be available until: Wed Apr 11 2018 20:17:57 GMT-0300 (-03)
Pair this client with another organization by giving an administrator this pairing code:
zEXgMr5
Pair this client with your organization:
https://0.0.0.0:23000/api-access-request?pairingCode=zEXgMr5
Then i access the link on the browser and get the message “Pairing is successful”, the token is now activated.
But when i try to invoke any methods i only get errors
root@ubuntu:/home/ubuntu/node_modules/bitpay/lib# bitpay whoami
Enter Key Password:
Error: { error: 'no-bitid' }
root@ubuntu:/home/ubuntu/node_modules/bitpay/lib# bitpay request -T pos -R invoices
Enter Key Password:
Error: { error: 'no-bitid' }
root@ubuntu:/home/ubuntu/node_modules/bitpay/lib# bitpay request -T pos -X post -R invoices -P '{"price": 15, "currency": "USD"}'
Enter Key Password:
Error: { error: 'no-bitid' }
I’ve commented the lines that check the type of the model of “controller.User.Identity” on “Extensions.cs” (just to help debugging)
public static BitIdentity GetBitIdentity(this Controller controller, bool throws = true) {
// if (!(controller.User.Identity is BitIdentity))
// return throws ? throw new UnauthorizedAccessException("no-bitid") : (BitIdentity)null;
return (BitIdentity)controller.User.Identity;
}
Now this error is thrown at server console
crit: PayServer: Unhandled exception in BTCPayMiddleware
System.InvalidCastException: Unable to cast object of type 'System.Security.Claims.ClaimsIdentity' to type 'BTCPayServer.Authentication.BitIdentity'.
at BTCPayServer.Extensions.GetBitIdentity(Controller controller, Boolean throws) in /home/ubuntu/btcpay/btcpayserver/BTCPayServer/Extensions.cs:line 117
Issue Analytics
- State:
- Created 5 years ago
- Comments:20 (13 by maintainers)
Top Results From Across the Web
Node Full SDK
BitPay NodeJS client. This SDK provides a convenient abstraction of BitPay's cryptographically-secure API and allows payment gateway developers to focus on ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
No I can’t fix this easily actually. Well anyway it works good! 😃
w00t… anyway it is a btcpay bug you had the 80 in the url… will check if I can solve this.