-
Notifications
You must be signed in to change notification settings - Fork 21
Open
Description
I'm trying to set up an app using the SDK, but I can't get my client to authorise.
Here's the relevant part of the docs that I fail to understand:
My question boils down to this: what do I put in the code argument?
This is my code:
const sdk = new SDK({
baseUrl: 'http://api-sandbox.uphold.com',
clientId: this.configService.get<string>('UPHOLD_CLIENT_ID'),
clientSecret: this.configService.get<string>('UPHOLD_CLIENT_SECRET'),
});
this.sdk = sdk;
sdk
// What do I insert here?
.authorize('code')
.then(() => sdk.getMe())
.then((user) => {
console.log('sdk', user);
});And the error that I get:
Unhandled rejection UnauthorizedError: unauthorized
at createError (/Users/joep/dev/src/gitlab.com/ontola/cash-link/node_modules/@uphold/uphold-sdk-javascript/dist/core/utils/error-factory.js:20:14)
at /Users/joep/dev/src/gitlab.com/ontola/cash-link/node_modules/@uphold/uphold-sdk-javascript/dist/node/services/request-client.js:31:167
at tryCatcher (/Users/joep/dev/src/gitlab.com/ontola/cash-link/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/Users/joep/dev/src/gitlab.com/ontola/cash-link/node_modules/bluebird/js/release/promise.js:547:31)
at Promise._settlePromise (/Users/joep/dev/src/gitlab.com/ontola/cash-link/node_modules/bluebird/js/release/promise.js:604:18)
at Promise._settlePromise0 (/Users/joep/dev/src/gitlab.com/ontola/cash-link/node_modules/bluebird/js/release/promise.js:649:10)
at Promise._settlePromises (/Users/joep/dev/src/gitlab.com/ontola/cash-link/node_modules/bluebird/js/release/promise.js:725:18)
at _drainQueueStep (/Users/joep/dev/src/gitlab.com/ontola/cash-link/node_modules/bluebird/js/release/async.js:93:12)
at _drainQueue (/Users/joep/dev/src/gitlab.com/ontola/cash-link/node_modules/bluebird/js/release/async.js:86:9)
at Async._drainQueues (/Users/joep/dev/src/gitlab.com/ontola/cash-link/node_modules/bluebird/js/release/async.js:102:5)
at Immediate.Async.drainQueues (/Users/joep/dev/src/gitlab.com/ontola/cash-link/node_modules/bluebird/js/release/async.js:15:14)
at processImmediate (node:internal/timers:463:21)
Suggestions
Maybe I'm just missing something trivial, or this step is actually very simple and I'm just lacking some basic knowledge, but otherwise:
- Return a more useful error then
Unhandled rejection UnauthorizedError: unauthorized - Change the example in the docs and the description field for the code parameter which currently says
Authorization code
Versions
Node v15.3.0, SDK 2.4.0
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
