# What do I do with an access token?

**URL:** <https://community.auth0.com/t/what-do-i-do-with-an-access-token/44343>\
**Category:** Get Help\
**Tags:** auth0\
**Created:** [June 9, 2020, 3:10am UTC](https://community.auth0.com/t/what-do-i-do-with-an-access-token/44343 "2020-06-09T03:10:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![to.jontan](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/to.jontan/32/21820_2.png) [@to.jontan](https://community.auth0.com/u/to.jontan)\
**Post date:** [June 9, 2020, 3:10am UTC](https://community.auth0.com/t/what-do-i-do-with-an-access-token/44343/1 "2020-06-09T03:10:17Z")

</div>

I have a react webapp, which I’m using to service my frontend, and another Java API Backend.

I’m currently using `@auth0/nextjs-auth0` to get user information from Auth0, which is working well.  
The `access_token` is being stored in the user session, and I can use it in the `Bearer ` header to call my API.

But I’m not sure what the Java backend is supposed to do with the token!

Do I make a call to Auth0 to confirm if this token is valid?  
Do I call [GetUserInfo](https://auth0.com/docs/api/authentication?http#get-user-info)?  
Do I use the Management API Access Token?

Not quite sure how to proceed at this point.  
Please advise.

---

<div class="post-metadata">

**Author:** ![JoshB2B](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/joshb2b/32/13039_2.png) [@JoshB2B](https://community.auth0.com/u/JoshB2B)\
**Post date:** [June 9, 2020, 3:33am UTC](https://community.auth0.com/t/what-do-i-do-with-an-access-token/44343/2 "2020-06-09T03:33:01Z")

</div>

I’ve implemented this approach using the JWT for bearer auth in a .NET backend. Not sure how it’s done in Java but in my startup file I enable bearer authentication using the IAppBuilder interface so I can use the UseJwtBearerAuthentication extension. It’s here I configure the allowed audiences and issuers etc.

I validate the JWT on each request using Owin either by overriding the OnActionExecuting or within a custom authentication attribute. I can then get the claims from the JWT from the user principal such as the users email, userId and any custom claims added from a rule. I use the userId to do a DB lookup for the user so I can add my own claims for the remaining request.

I also use the ManagementApi using the .NET SDK for creating/updating users, changing pws etc

Take a look at the docs and see if there is a Java code example.

---

<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:** [June 24, 2020, 3:33am UTC](https://community.auth0.com/t/what-do-i-do-with-an-access-token/44343/3 "2020-06-24T03:33:06Z")

</div>

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