# Unable to call my API with Authorization method. (problems with Access Token)

**URL:** <https://community.auth0.com/t/unable-to-call-my-api-with-authorization-method-problems-with-access-token/97814>\
**Category:** Get Help\
**Tags:** grants, management-api\
**Created:** [January 10, 2023, 7:45am UTC](https://community.auth0.com/t/unable-to-call-my-api-with-authorization-method-problems-with-access-token/97814 "2023-01-10T07:45:45Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Totodile](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/totodile/32/12714_2.png) [@Totodile](https://community.auth0.com/u/Totodile)\
**Post date:** [January 10, 2023, 7:45am UTC](https://community.auth0.com/t/unable-to-call-my-api-with-authorization-method-problems-with-access-token/97814/1 "2023-01-10T07:45:45Z")

</div>

Hello everyone.

I’m having problems trying to access endpoints that requires authorization and don’t really know how to solve it… Here is the thing:

- I’ve an Angular APP which implements Auth0/Angular library. In Auth0, I’ve created a Single Page Application, so in my configuration settings I’m using it’s domain and ClientID. The application is working fine and also de login, and I can find the accessToken (with getAccessTokenSilently) and also the idToken(with getIdTokenClaims).
- My backend, is a .NET App. I’ve created a Regular Web Application in Auth0 and also im using its configuration seetings with the domain and ClientId (the domain is the same between 2 apps but ClientId is different).

So now, when Im testing an endpoint with Swagger which requires Authorization, I try to authorize with the accessToken or the idToken that the Angular app provides, but its giving me errors and is not working. How can I solve that? Is because the audiences are different? What should I do? (In conf settings, Domain and Audience matches between 2 apps)

Thank you in advance.

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [January 11, 2023, 10:39pm UTC](https://community.auth0.com/t/unable-to-call-my-api-with-authorization-method-problems-with-access-token/97814/3 "2023-01-11T22:39:12Z")

</div>

Hey there @Totodile !

> [@Totodile](#):
>
> So now, when Im testing an endpoint with Swagger which requires Authorization, I try to authorize with the accessToken or the idToken that the Angular app provides, but its giving me errors and is not working. How can I solve that? Is because the audiences are different? What should I do? (In conf settings, Domain and Audience matches between 2 apps)

Regardless of the framework, you’ll need the access token and not the ID token to call your API. What type of errors are you receiving? Anything helpful? If I had to guess it would be due to a mismatch in audience value - The audience (API identifier) you call /authorize with needs to match the audience configured at your API.

[https://community.auth0.com/t/audience-is-invalid-error/84588](https://community.auth0.com/t/audience-is-invalid-error/84588)

Keep us posted!

---

<div class="post-metadata">

**Author:** ![Totodile](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/totodile/32/12714_2.png) [@Totodile](https://community.auth0.com/u/Totodile)\
**Post date:** [January 12, 2023, 7:28am UTC](https://community.auth0.com/t/unable-to-call-my-api-with-authorization-method-problems-with-access-token/97814/4 "2023-01-12T07:28:21Z")

</div>

Hello @ty.frith and thank you for your answer.

The audience param was the same between the 2 apps, the only different param was the CliendIt… I managed to create an endpoint in my backend API to create a response with the accessToken and the idToken, so when I login in my front end I can set the response in LocalStorage and set in Headers as a Bearer Authorization in order to access my authorized endpoints. I guess I will find some problems with that method but for now it’s working. 😅

Thank you!

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [January 13, 2023, 12:22am UTC](https://community.auth0.com/t/unable-to-call-my-api-with-authorization-method-problems-with-access-token/97814/5 "2023-01-13T00:22:27Z")

</div>

No problem, happy to help where I can! Thanks for following up here 😄

---

<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:** [January 27, 2023, 12:22am UTC](https://community.auth0.com/t/unable-to-call-my-api-with-authorization-method-problems-with-access-token/97814/6 "2023-01-27T00:22:29Z")

</div>

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