# Issue access token after third party API validation and include custom claims .NET API

**URL:** <https://community.auth0.com/t/issue-access-token-after-third-party-api-validation-and-include-custom-claims-net-api/7589>\
**Category:** Get Help\
**Tags:** api-authorization, client-metadata, api, client-credentials-g, authentication\
**Created:** [July 20, 2017, 12:16am UTC](https://community.auth0.com/t/issue-access-token-after-third-party-api-validation-and-include-custom-claims-net-api/7589 "2017-07-20T00:16:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![m.wagner](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/m.wagner/32/7815_2.png) [@m.wagner](https://community.auth0.com/u/m.wagner)\
**Post date:** [July 20, 2017, 12:16am UTC](https://community.auth0.com/t/issue-access-token-after-third-party-api-validation-and-include-custom-claims-net-api/7589/1 "2017-07-20T00:16:59Z")

</div>

Hi! I’m hoping to get some clarification and guidance with an API authentication flow that I am trying to implement in my [ASP.NET](http://ASP.NET) C# Web API. I have some key goals:

1. Use a trusted third-party’s jwt to authenticate with my own API via an Angular web app.
2. Include some custom information (like an account number) in the access token so that people are limited to their own stuff only.
3. Allow other clients to authenticate with my API directly for separate use cases.

Here’s the current outline as I’m envisioning it:

![flow chart][1]

1. Person signs in to the client web app, authenticating with trusted API that drives most of the web app.
2. Token A is issued to the client web app for future requests to Trusted API.
3. Client web app sends Token A to `My API` for a second authentication step.
4. `My API` sends a request to Trusted API, validating Token A and requesting account information.
5. Trusted API sends account information response to `My API`.
6. `My API` uses “Client Credentials Exchange”(?) to get an access token from Auth0, adding custom claims.
7. Auth0 responds with Token B, the access token for `My API` (containing custom claims)
8. `My API` issues Token B to the client web app for future requests to `My API`

Is this approach possible with Auth0? Right now, the only thing that is aware of Auth0 is `My API`. I am also stumbling with the correct way to add the custom information into the access token since `My API` will be doing it programmatically.

Any guidance you could provide would be greatly appreciated. Please let me know if I’m approaching this all-wrong too!

---

<div class="post-metadata">

**Author:** ![andrem](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@andrem](https://community.auth0.com/u/andrem)\
**Post date:** [August 8, 2017, 1:21am UTC](https://community.auth0.com/t/issue-access-token-after-third-party-api-validation-and-include-custom-claims-net-api/7589/2 "2017-08-08T01:21:22Z")

</div>

Did you find a solution to this problem?  
It sounds like you need a version of this: [draft-ietf-oauth-token-exchange-03](https://tools.ietf.org/html/draft-ietf-oauth-token-exchange-03)

Essentially, exchange an ID token from a third party for an API access token at OAuth.

The real world physical use case is: exchange passport for room key at hotel

I don’t believe Auth0 implements this yet (if ever). However, an approach to try is to build a service that:

1. Validates incoming trusted third party JWT from client
2. Mint a custom API access token using private key + suitable JWT library
3. Send API access token back to client

---

<div class="post-metadata">

**Author:** ![andrem](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@andrem](https://community.auth0.com/u/andrem)\
**Post date:** [August 8, 2017, 2:30am UTC](https://community.auth0.com/t/issue-access-token-after-third-party-api-validation-and-include-custom-claims-net-api/7589/3 "2017-08-08T02:30:26Z")

</div>

Note: in order to mint a custom API access token you will probably need to use HS256 and the shared secret. If you create an API with RS256 there does not appear to be a way to retrieve the private key in order to mint your tokens with.

---

<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/issue-access-token-after-third-party-api-validation-and-include-custom-claims-net-api/7589/4 "2018-03-02T05:55:30Z")

</div>


