MiguelMedeiros / lnbits-js

NPM Package for LNBits.com API.
23 stars 14 forks source link

usermanager.getUsers() HTTPException 401: Admin key required. #10

Closed koodinmies closed 1 year ago

koodinmies commented 1 year ago

I setup lnbits with docker option:

https://github.com/lnbits/lnbits/blob/main/docs/guide/installation.md#option-4-docker

I created a new wallet at localhost:5000.

I copied the adminkey and readkey from the web view to my code and I can get a response from:

let walletdetai = await wallet.walletDetails();

{ id: 'fd12341d727b4fbb8d753a7c1f4ae1f0', name: 'wall', balance: 0 }

When I try to use:

await userManager.getUsers();

I get an error in the docker container saying:

ERROR | HTTPException 401: Admin key required.

I can't give the adminkey as a parameter to the getUsers() since it doesn't have any?

koodinmies commented 1 year ago

It seems that you have to add in the request headers:

"X-API-KEY" : ""