# Unauthorised from getProfile

**URL:** <https://community.auth0.com/t/unauthorised-from-getprofile/90939>\
**Category:** Get Help\
**Tags:** node-auth0\
**Created:** [September 20, 2022, 7:16am UTC](https://community.auth0.com/t/unauthorised-from-getprofile/90939 "2022-09-20T07:16:44Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![nishantv12](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/nishantv12/32/40042_2.png) [@nishantv12](https://community.auth0.com/u/nishantv12)\
**Post date:** [September 20, 2022, 7:16am UTC](https://community.auth0.com/t/unauthorised-from-getprofile/90939/1 "2022-09-20T07:16:44Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Owens5986](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/owens5986/32/14506_2.png) [@Owens5986](https://community.auth0.com/u/Owens5986)\
**Post date:** [September 21, 2022, 4:46am UTC](https://community.auth0.com/t/unauthorised-from-getprofile/90939/2 "2022-09-21T04:46:54Z")

</div>

Easy profile [!](https://www.mylabcorp.us/)

---

<div class="post-metadata">

**Author:** ![nishantv12](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/nishantv12/32/40042_2.png) [@nishantv12](https://community.auth0.com/u/nishantv12)\
**Post date:** [September 21, 2022, 6:03am UTC](https://community.auth0.com/t/unauthorised-from-getprofile/90939/3 "2022-09-21T06:03:54Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![nishantv12](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/nishantv12/32/40042_2.png) [@nishantv12](https://community.auth0.com/u/nishantv12)\
**Post date:** [September 21, 2022, 11:28am UTC](https://community.auth0.com/t/unauthorised-from-getprofile/90939/4 "2022-09-21T11:28:01Z")

</div>

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` .

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [October 5, 2022, 11:28am UTC](https://community.auth0.com/t/unauthorised-from-getprofile/90939/5 "2022-10-05T11:28:17Z")

</div>

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