# Angular -\> C# authorization failure

**URL:** <https://community.auth0.com/t/angular-c-authorization-failure/99512>\
**Category:** Get Help\
**Tags:** users, management-api\
**Created:** [February 1, 2023, 10:43pm UTC](https://community.auth0.com/t/angular-c-authorization-failure/99512 "2023-02-01T22:43:55Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![ckim91](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ckim91/32/9696_2.png) [@ckim91](https://community.auth0.com/u/ckim91)\
**Post date:** [February 1, 2023, 10:43pm UTC](https://community.auth0.com/t/angular-c-authorization-failure/99512/1 "2023-02-01T22:43:56Z")

</div>

Recently I’ve updated my front end website from Angular 12 to 15 after about 2 years and I redownloaded the packages again and I also had to reimplement Auth0 because now it uses a different codebase since the last time. I can log in with it fine, but trying to use it to authenticate with my C# Web API is completely broken.

The Quickstart for AuthModule is completely wrong. It doesn’t even use the correct variable name for one of them and there’s a missing comma. Even then, it was missing a redirect-uri, which caused it to throw an error after logging in. Now, no matter what settings I’ve used, I keep getting a 401 error whenever I try to call a private route in my API (anything with the [Authorize] tag), but public routes work normally. I cannot find any solution for this. I’ve checked my API configurations, and I don’t think that’s the case because it basically uses the same code as the last version.

Attached is my declaration for AuthModule in app.module.ts. I need a solution to this urgently.

```auto
AuthModule.forRoot({
      domain: 'APP_DOMAIN',
      clientId: 'APP_CLIENT_ID',
      authorizationParams: {
        audience: 'API_IDENTIFIER',
        scope: 'read:messages',
        redirect_uri: window.location.origin
      },
      httpInterceptor: {
        allowedList: [
          {
            uri: 'API_IDENTIFIER/*',
            tokenOptions: {
              authorizationParams: {
                audience: 'API_IDENTIFIER',
                scope: 'read:messages'
              }
            }
          }
        ]
      }
    }),

```

I even used the C# sample project and it gives me the same problems. Am I missing something. here?

```auto
var domain = $"https://{Configuration["Auth0:Domain"]}/";
services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
    .AddJwtBearer(options =>
    {
        options.Authority = domain;
        options.Audience = Configuration["Auth0:Audience"];
        options.TokenValidationParameters = new TokenValidationParameters
        {
            NameClaimType = ClaimTypes.NameIdentifier
        };
    });

```

---

<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:** [February 3, 2023, 7:49am UTC](https://community.auth0.com/t/angular-c-authorization-failure/99512/2 "2023-02-03T07:49:56Z")

</div>

Hey there!

Can you share precisely what quickstart or SDK are you trying to use in your implementation so we can try to help you? Thank you!

---

<div class="post-metadata">

**Author:** ![ckim91](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ckim91/32/9696_2.png) [@ckim91](https://community.auth0.com/u/ckim91)\
**Post date:** [February 3, 2023, 2:42pm UTC](https://community.auth0.com/t/angular-c-authorization-failure/99512/3 "2023-02-03T14:42:25Z")

</div>

I followed this.

> **[Auth0 Angular SDK Quickstarts: Call an API](https://auth0.com/docs/quickstart/spa/angular/02-calling-an-api)**
>
> This tutorial demonstrates how to make API calls to the Auth0 Management API.

I’ve tried using the generated code in the page and I downloaded the sample app, too, and neither of them work.

---

<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:** [February 6, 2023, 10:51am UTC](https://community.auth0.com/t/angular-c-authorization-failure/99512/4 "2023-02-06T10:51:40Z")

</div>

Can I ask you to raise this as a GitHub issue here:

> **[auth0-angular-samples/Sample-01 at master · auth0-samples/auth0-angular-samples](https://github.com/auth0-samples/auth0-angular-samples/tree/master/Sample-01)**
>
> master/Sample-01

so we can work on that directly with the quickstart maintainer directly? Once you have a link to it you can share it here so we can ping them. Thank you!

---

<div class="post-metadata">

**Author:** ![ckim91](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ckim91/32/9696_2.png) [@ckim91](https://community.auth0.com/u/ckim91)\
**Post date:** [February 6, 2023, 2:27pm UTC](https://community.auth0.com/t/angular-c-authorization-failure/99512/5 "2023-02-06T14:27:30Z")

</div>

Raised the issue.

> <https://github.com/auth0-samples/auth0-angular-samples/issues/344>
>
> Recently I updated my web app from about 2 years ago, and I updated auth0 to go …with it (I went from 1.5.1 to 2.0.1). I can log in fine, but when I try to use auth0 to call a private route in my C# Web API, it doesn't work anymore. I even tried using the sample applications for both the Angular and C# Web API Quickstarts and it still failed.

---

<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:** [February 7, 2023, 12:31pm UTC](https://community.auth0.com/t/angular-c-authorization-failure/99512/6 "2023-02-07T12:31:19Z")

</div>

Thank you! I’ll ping the repo maintainers in a few minutes!

---

<div class="post-metadata">

**Author:** ![ckim91](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ckim91/32/9696_2.png) [@ckim91](https://community.auth0.com/u/ckim91)\
**Post date:** [February 10, 2023, 8:21pm UTC](https://community.auth0.com/t/angular-c-authorization-failure/99512/7 "2023-02-10T20:21:08Z")

</div>

So I got it fixed, and it had to do with my application using the wrong settings.

But now I have another problem. After I upload my Web API (it’s hosted on AWS Elastic Beanstalk) and call a private route there, the authorization fails. If I run it locally, authorization works fine.

---

<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 24, 2023, 8:21pm UTC](https://community.auth0.com/t/angular-c-authorization-failure/99512/8 "2023-02-24T20:21:55Z")

</div>

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