Closed imrehg closed 9 years ago
Apologies. The examples are in a bit of a disarray as we are pretty rapidly iterating on our new API. In regard to this specific error:
{ error: 'You do not have access to this resource. (user)' }
This means that the client attempted to create a bill using the "user" facade - which is not authorized to do so. I'd check to make sure that you have a merchant token associated with your key.
If you pull the latest code (and we have made backwards incompatible changes), use the CLI tool to get your tokens:
$ bitpay request -T user -R tokens
If you are setup correctly, you should get back something like this:
[ { "merchant": "<% token_string %>" } ]
Let me know your results!
Closing, due to inactivity. Feel free to reopen if you are still having issues.
When I use the default
bitpay login -e <myemail>
method, I get this message during the authorization:Afterwards, if I for example want to create bills, naturally I get this error message:
On the other hand, I can't seem to find an example for logging in to access the merchant functions. If I modify the login action similarly as e.g. I see in the
examples/create-bill.js
, along the lines ofvar encPrivkey = fs.readFileSync(HOME + '/.bitpay/api.key').toString(); var config = require('../config'); var privkey = bitauth.decrypt(config.keyPassword, encPrivkey); var client = new BitPay(privkey);
and use that client in the
bitpay
script's login action, the results is:So either way, i can't seem to actually log in such a way that I could run e.g. the
examples/create-bill.js
example correctly... What am I missing?