# Angular and .NET 6 integrated

**URL:** <https://community.auth0.com/t/angular-and-net-6-integrated/124647>\
**Category:** JWT.io\
**Tags:** access-token, .net, angular, login\
**Created:** [January 11, 2024, 1:39pm UTC](https://community.auth0.com/t/angular-and-net-6-integrated/124647 "2024-01-11T13:39:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![lahiru.gambheera](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@lahiru.gambheera](https://community.auth0.com/u/lahiru.gambheera)\
**Post date:** [January 11, 2024, 1:39pm UTC](https://community.auth0.com/t/angular-and-net-6-integrated/124647/1 "2024-01-11T13:39:25Z")

</div>

I’m wring an client server application with Angular and .NET 6 to implement Autherization and Autherization with Auth0. Here I’m following **Authorization Code Flow** These are the steps that I have followed

1. Created Single page Application with Angular and added Auth0 login.
2. I logged in and fetched the access token from “**getAccessTokenSilently()**” method.  
when I checked with [jwt.io](http://jwt.io), it says Invalid Signature.
3. Then I tried with **idTokenClaims$** like this

```auto
this.auth.idTokenClaims$.subscribe(idToken => {
      console.log('Id Token: ', idToken);
      this.accessToken = idToken?.__raw;
    });

```

1. Then no issue from [jwt.io](http://jwt.io). But .Net back end with Autorize Attribute. My Program.cs is like this.

```auto
builder.Services.AddAuthentication(options =>
{
    options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
    options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme;
}).AddJwtBearer(options =>
{
    options.Authority = "https://dev-fi4bsupwmm2ptx7c.us.auth0.com/";
    options.Audience = "https://localhost:7181/";
});

```

Error message: Bearer error=“invalid\_token”

1. There is no any place to set **Audience** in my single page application in Auth0 side.

What can be the problem? How can I solve this?

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [January 19, 2024, 4:18pm UTC](https://community.auth0.com/t/angular-and-net-6-integrated/124647/3 "2024-01-19T16:18:11Z")

</div>

Hi @lahiru.gambheera,

The access token and ID token are not the same thing. Your backend isn’t going to accept the ID token.

You need to pass an audience param with the request to get a JWT that your backend can consume, otherwise you are going to get an [opaque token](https://community.auth0.com/t/why-is-my-access-token-not-a-jwt-opaque-token/31028).

You can see how to add an audience param in this guide: [Auth0 Angular SDK Quickstarts: Call an API](https://auth0.com/docs/quickstart/spa/angular/02-calling-an-api)

Alternatively, you can add it to the request to getAccessTokenSilently.

Hope this helps!

---

<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:** [February 2, 2024, 4:18pm UTC](https://community.auth0.com/t/angular-and-net-6-integrated/124647/4 "2024-02-02T16:18:16Z")

</div>

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