# Can my api server trust the access token from auth0?

**URL:** <https://community.auth0.com/t/can-my-api-server-trust-the-access-token-from-auth0/110240>\
**Category:** Get Help\
**Tags:** configuration, application\
**Created:** [June 29, 2023, 6:44am UTC](https://community.auth0.com/t/can-my-api-server-trust-the-access-token-from-auth0/110240 "2023-06-29T06:44:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![salmon.vupham](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@salmon.vupham](https://community.auth0.com/u/salmon.vupham)\
**Post date:** [June 29, 2023, 6:44am UTC](https://community.auth0.com/t/can-my-api-server-trust-the-access-token-from-auth0/110240/1 "2023-06-29T06:44:40Z")

</div>

I’m using this workflow: [Authorization Code Flow (auth0.com)](https://auth0.com/docs/get-started/authentication-and-authorization-flow/authorization-code-flow)

In step 5, the app make a request to my server with an access token which is generated by auth0

This is the guide to validate the access token in the server: [Auth0 ASP.NET Core Web API SDK Quickstarts: Add Authorization to an ASP.NET Core Web API application](https://auth0.com/docs/quickstart/backend/aspnet-core-webapi/interactive)

According to the guide, I see they only validate the issuer and audience, what if someone know the issuer and audience and create a fake access token with that information? will my server be tricked?

Is there a way to validate the access token in my server securely?

---

<div class="post-metadata">

**Author:** ![toanderson](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@toanderson](https://community.auth0.com/u/toanderson)\
**Post date:** [July 3, 2023, 9:00pm UTC](https://community.auth0.com/t/can-my-api-server-trust-the-access-token-from-auth0/110240/3 "2023-07-03T21:00:01Z")

</div>

I’m not an Auth0 employee, but I do know that the Microsoft [ASP.NET](http://ASP.NET) Core Authentication library validates the signature on the JWT token behind the scenes.

Here is a high-level overview of what happens:

1. The API server is configured using the `Microsoft.AspNetCore.Authentication.JwtBearer` package. This can be seen on Step 5 that you referenced - be sure to select the `Program.cs` header in the code sample.
2. In step 5, the `options.Authority` attribute is set to the Auth0 domain. The [ASP.NET](http://ASP.NET) Core Authentication framework uses this URL to query the Auth0 server for metadata, specifically the public key that Auth0 uses to sign its JWT tokens.
3. When a request is received on a secured API endpoint, the [ASP.NET](http://ASP.NET) Core Authentication framework validates the signature on the request JWT token using the public key on the certificate that it fetched earlier from Auth0. It also performs other validation checks mentioned at [Validate JSON Web Tokens | Auth0](https://auth0.com/docs/secure/tokens/json-web-tokens/validate-json-web-tokens).

Therefore, it is validating more than only the issuer and audience, but it’s all behind the scenes.

---

<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:** [July 17, 2023, 9:00pm UTC](https://community.auth0.com/t/can-my-api-server-trust-the-access-token-from-auth0/110240/4 "2023-07-17T21:00:21Z")

</div>

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