# SPA+API+User Profiles - Confused

**URL:** <https://community.auth0.com/t/spa-api-user-profiles-confused/12225>\
**Category:** Get Help\
**Created:** [June 10, 2018, 7:50am UTC](https://community.auth0.com/t/spa-api-user-profiles-confused/12225 "2018-06-10T07:50:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![lgomez](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/lgomez/32/8170_2.png) [@lgomez](https://community.auth0.com/u/lgomez)\
**Post date:** [June 10, 2018, 7:50am UTC](https://community.auth0.com/t/spa-api-user-profiles-confused/12225/1 "2018-06-10T07:50:19Z")

</div>

Hello all,

I’m trying to figure out how to load user profile data from a Node API. The request comes from an SPA (react) which uses Auth0 to authenticate users, passes along the bearer token to an API that uses that verifies that token and returns some data. The thing is, I need the API to load user profile data from Auth0 somehow. I thought I’d get some sort of obvious identifier in the bearer token sent by the SPA but I don’t see it. Then, when I try to use that token to fire off a call to the Auth0 server from said API, I get an Unauthorized response. Does anyone know of any sample code to get this done? The Auth0 docs (which are normally very easy and complete) have got me confused and nothing I’ve tried has worked.

Thank you for your help!

---

<div class="post-metadata">

**Author:** ![thijmen96](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/thijmen96/32/20356_2.png) [@thijmen96](https://community.auth0.com/u/thijmen96)\
**Post date:** [June 10, 2018, 12:42pm UTC](https://community.auth0.com/t/spa-api-user-profiles-confused/12225/2 "2018-06-10T12:42:10Z")

</div>

You’ll want your Node API to talk to the Auth0 Management API. You can’t do that with the token provided to the user, as the Management API is used to do all sorts of things like create, update and delete users, connections and applications.

Auth0 has a great library ready to go for Node.js:

> **[GitHub - auth0/node-auth0: Node.js client library for the Auth0 platform.](https://github.com/auth0/node-auth0)**
>
> Node.js client library for the Auth0 platform. Contribute to auth0/node-auth0 development by creating an account on GitHub.

If you need to identity the user that’s sending the access token to your API, you can use `sub`. This is the user ID, so you can take that `sub` straight from the access token to your Management API call. For everything there is to know about access tokens, check out:

> **[Access Tokens](https://auth0.com/docs/secure/tokens/access-tokens)**
>
> Describes how access tokens are used in token-based authentication to allow an application to access an API after a user successfully authenticates and authorizes access.

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [July 25, 2019, 2:03pm UTC](https://community.auth0.com/t/spa-api-user-profiles-confused/12225/3 "2019-07-25T14:03:30Z")

</div>


