# Auth0 implementation with Angular and .Net Cire

**URL:** <https://community.auth0.com/t/auth0-implementation-with-angular-and-net-cire/41646>\
**Category:** Get Help\
**Created:** [April 23, 2020, 3:00pm UTC](https://community.auth0.com/t/auth0-implementation-with-angular-and-net-cire/41646 "2020-04-23T15:00:36Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![r3plica](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/r3plica/32/12805_2.png) [@r3plica](https://community.auth0.com/u/r3plica)\
**Post date:** [April 23, 2020, 3:00pm UTC](https://community.auth0.com/t/auth0-implementation-with-angular-and-net-cire/41646/1 "2020-04-23T15:00:36Z")

</div>

I have created an API and an SPA in my dashboard and I have tested the API using postman and it all works fine.  
In my Angular application I replaced my auth.service, auth.guard with the ones in the SPA getting started example and was able to login, which is good. Then I needed to communicate with my API, so I used this repo:

[https://github.com/auth0-samples/auth0-angular-samples/tree/master/02-Calling-an-API/src/app/auth](https://github.com/auth0-samples/auth0-angular-samples/tree/master/02-Calling-an-API/src/app/auth)

And took the interceptor there and added the new method **getTokenSilently$** which appeared to work. But my API returns a 401 unauthorised response.

If I look in the console, I can see that the bearer token it is sending is significantly shorter than the one I pasted into postman:

> Bearer 5Pn186637eLfc\_lqCGK-P4u2YCuHXCNR

vs

> Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6InJhaGpWejlJUnI3eElxZDRaYmJiYyJ9.eyJpc3MiOiJodHRwczovL3IzcGxpY2EuZXUuYXV0aDAuY29tLyIsInN1YiI6IkdXN2RJcElEZ3BUOXJPM05RT3hZOFlKUWtKcGpTWVY3QGNsaWVudHMiLCJhdWQiOiJodHRwczovL2xvY2FsaG9zdDo0NDM5Mi8iLCJpYXQiOjE1ODc2NDcwNzgsImV4cCI6MTU4NzczMzQ3OCwiYXpwIjoiR1c3ZElwSURncFQ5ck8zTlFPeFk4WUpRa0pwalNZVjciLCJndHkiOiJjbGllbnQtY3JlZGVudGlhbHMifQ.a305uDzFalEw8-enE-L3BWOjm6LsMN8eWJjun\_FISMy3JgG6aD0-bKZHVI1txBeEHRHva3Omc-vTcT2E1fBfD1TMiAelhaIpKduqzk2dN9fab85PioqKDlCf62QtOudd35WUcbBfriq1-e1JEv9HYYOblWe-6jGQstK77d1kNRC13uwQdA0pYF3Dbh8rScVIG7P2VWFJwE\_0zdcddpj2u1bfQInCn8rbc7bst\_DbRIA7QMKRgNT1p90hhoeo40hM1\_TM5iBuXVJG9j5sXQ4StsWzSw7l\_p8IZv8Uy\_ayMFX2Rawu7JGmgCcw1uOJmmPJ\_G8FjIfQWrU5NkDza98EGg

Does anyone know why? I assume it is a simple fix, but I am not sure what to do…

---

<div class="post-metadata">

**Author:** ![r3plica](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/r3plica/32/12805_2.png) [@r3plica](https://community.auth0.com/u/r3plica)\
**Post date:** [April 23, 2020, 3:10pm UTC](https://community.auth0.com/t/auth0-implementation-with-angular-and-net-cire/41646/2 "2020-04-23T15:10:10Z")

</div>

Hmm, I figured this out. It’s not very well documented, but you have to include the **audience** when making your call. To find the audience, you simply look at your **apis** in your dashboard and it states the audience there:

 ![Untitled](https://global.discourse-cdn.com/auth0/original/3X/e/3/e3620bd99d992f89b3df355a170a566cd48a775e.png)

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [April 24, 2020, 8:13am UTC](https://community.auth0.com/t/auth0-implementation-with-angular-and-net-cire/41646/3 "2020-04-24T08:13:40Z")

</div>

Thanks for sharing it with the rest of community!

---

<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:** [May 9, 2020, 8:27am UTC](https://community.auth0.com/t/auth0-implementation-with-angular-and-net-cire/41646/4 "2020-05-09T08:27:34Z")

</div>

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