Unauthorised from getProfile

I am trying to migrate authentication via auth0 from a jvm based solution which uses auth0 rest api to a node based solution using node-auth0.
At present its a 2 step process:

  1. Get token via POST /oauth/token
  2. Get user profile via /userInfo using the token obtained in step 1

In the node application, I am constructing AuthenticationClient while providing clientId , clientSecret and domain as AuthenticationClientOptions and able to get the token successfully using passwordGrant but when I use the same authenticationClient object to call getProfile while providing the token obtained from passwordGrant, I get this error:

Request failed with status code 401

What’s confusing is that in Auth0 dashboard, this request is successful.
This suggests that the error is from the library.
I am new to the whole node ecosystem in general. Any help is highly appreciated.

Please include the following information in your post:

  • Which SDK this is regarding: node-auth0
  • SDK Version: 2.42.0
  • Platform Version: Node 15.14.0
  • Code Snippets/Error Messages/Supporting Details/Screenshots:
    Error: Request failed with status code 401

Is this a feature request or bug report? If so, please create an issue directly in the corresponding GitHub repo. The Community SDK category is for general discussion and support.

Easy profile !

Hi @Owens5986 , thanks for your reply. But I am sorry I didn’t get it.

Figured this out on my own. The token obtained via passwordGrant will be processed to respond for userInfo. Hence, the token must have in its audience claim <your-auth0-domain>/userInfo .

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.