Getting an Error when creating a User Access Tokens without SDKs

Highlighted
New Contributor

Getting an Error when creating a User Access Tokens without SDKs

Hi, I follow the instructions for creating a token in the link JWT without SDKs  and it works perfect but when I changed the claims for a user token as described in the link User Access Token  Im getting this error:

UnhandledPromiseRejectionWarning: Error: Request failed with status code 400
at createError (/Users/danielrodriguez/Desktop/Proyectos/Jasmine/node_modules/axios/lib/core/createError.js:16:15)
at settle (/Users/danielrodriguez/Desktop/Proyectos/Jasmine/node_modules/axios/lib/core/settle.js:17:12)
at IncomingMessage.handleStreamEnd (/Users/danielrodriguez/Desktop/Proyectos/Jasmine/node_modules/axios/lib/adapters/http.js:236:11)
at IncomingMessage.emit (events.js:224:7)
at endReadableNT (_stream_readable.js:1206:12)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
(node:9355) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:9355) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

 

Does anyone knows how to correct this?

Thanks.

Tags (3)
1 REPLY 1
Highlighted
Box Employee

Re: Getting an Error when creating a User Access Tokens without SDKs

Hi @danielrod99,

 

Without seeing the code and just the error, my first assumption is that you're not properly catching potential errors from the Promise.

 

It should look something like this:

 

async function one() {
  try {    
    await Promise.reject('err');
  } catch (e) {
     // e caught here
  }
}