# Authorize your APIs by logged in User

**URL:** <https://community.auth0.com/t/authorize-your-apis-by-logged-in-user/7699>\
**Category:** Get Help\
**Tags:** log-in, authorize-endpoint, user, authorize\
**Created:** [July 31, 2017, 5:13pm UTC](https://community.auth0.com/t/authorize-your-apis-by-logged-in-user/7699 "2017-07-31T17:13:30Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![amna768](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@amna768](https://community.auth0.com/u/amna768)\
**Post date:** [July 31, 2017, 5:13pm UTC](https://community.auth0.com/t/authorize-your-apis-by-logged-in-user/7699/1 "2017-07-31T17:13:30Z")

</div>

I have a regular web application and one custom API.

I have authenticated user using AUth0 and now want to Authorize API with this logged-in user.

I am trying to implement OIDC here.  
I have enabled OIDC in advance settings, and tried sending **access\_token** and **id\_token** both in header Bearer but no luck in Authorizing.

Can you please explain, what to do?

---

<div class="post-metadata">

**Author:** ![jmangelo](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jmangelo/32/7923_2.png) [@jmangelo](https://community.auth0.com/u/jmangelo)\
**Post date:** [July 31, 2017, 6:25pm UTC](https://community.auth0.com/t/authorize-your-apis-by-logged-in-user/7699/2 "2017-07-31T18:25:05Z")

</div>

If you haven’t done so already you should read the [reference documentation](https://auth0.com/docs/api-auth/grant/authorization-code) on how to setup a server-side web application to call into an API (aka resource server) while following the OIDC and OAuth2 protocols.

In addition, if your technologies are covered by the available quickstarts you should follow the code for the ones that apply to your case:

- [Web Application Quickstarts](https://auth0.com/docs/quickstart/webapp)
- [API Quickstarts](https://auth0.com/docs/quickstart/backend)

In conclusion, first you get the access token and then you call your API; if your API is rejecting the access token then you either did not request a suitable access token or the API is configured incorrectly. In either case, the amount of information provided is not enough to even try to guess the possible root cause.

---

<div class="post-metadata">

**Author:** ![amna768](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@amna768](https://community.auth0.com/u/amna768)\
**Post date:** [August 2, 2017, 12:14pm UTC](https://community.auth0.com/t/authorize-your-apis-by-logged-in-user/7699/3 "2017-08-02T12:14:08Z")

</div>

I did it this way **[reference documentation](https://auth0.com/docs/api-auth/grant/authorization-code)**, but this is the access\_token against a client in auth0 and not a user.  
I wanted to authorize API with user access\_token so that I can access claims of user in my API.

With access\_token of client I cannot access Identity Claims of logged in user in my API.

---

<div class="post-metadata">

**Author:** ![amna768](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@amna768](https://community.auth0.com/u/amna768)\
**Post date:** [August 2, 2017, 12:14pm UTC](https://community.auth0.com/t/authorize-your-apis-by-logged-in-user/7699/4 "2017-08-02T12:14:08Z")

</div>

I did it this way **[reference documentation](https://auth0.com/docs/api-auth/grant/authorization-code)**, but this is the access\_token against a client in auth0 and not a user.  
I wanted to authorize API with user access\_token so that I can access claims of user in my API.

With access\_token of client I cannot access Identity Claims of logged in user in my API.

---

<div class="post-metadata">

**Author:** ![jmangelo](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jmangelo/32/7923_2.png) [@jmangelo](https://community.auth0.com/u/jmangelo)\
**Post date:** [August 2, 2017, 6:02pm UTC](https://community.auth0.com/t/authorize-your-apis-by-logged-in-user/7699/5 "2017-08-02T18:02:48Z")

</div>

The linked reference documentation is for the authorization code grant; this grant implies the presence of the end-user and the issued token represents the grant that the end-user provided to the client application as means to provide actions on their behalf. Within the access token (which is currently a JWT) there will a `sub` claim that contains the user identifier. If you need more information, you can use [custom claims](https://auth0.com/docs/api-auth/tutorials/adoption/scope-custom-claims#custom-claims).

---

<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:** [March 2, 2018, 5:55am UTC](https://community.auth0.com/t/authorize-your-apis-by-logged-in-user/7699/6 "2018-03-02T05:55:41Z")

</div>


