The Complete Guide to Angular User Authentication with Auth0

I am running angular and express in wsl2. My browser is Chromium Edge in my windows computer.

Hi, @dan-auth0 @konrad.sopala Could anyone help me ? Thank you!

Hi, wondering if there are any updates regarding role-based access control for Angular?

1 Like

Tagging @dan-auth0 for visibility

I am looking to explore how we could use Auth0 Fine-Grained Authorization for this :slight_smile: Check out the Dev Preview, please:


(post deleted by author)

Hi! Thanks for the tutorial, it helps a lot in understanding the process with Angular. So I tried to get this going using standalone components. I’m quite new to Angular and so I couldn’t succeed… I think the critical part which is not working is the initialization of the AuthModule. I fired it in main.ts via:

bootstrapApplication(AppComponent, {
  providers: [
        httpInterceptor: {

In the app.component the definition looks like this:

  standalone: true,
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.sass'],
  imports: [CommonModule, MaterialModule, RouterModule, AuthModule],
export class AppComponent {
  constructor(public auth: AuthService) {}
  onLogin() {
  onLogout() {


The interesting, not working part is in the app.component.html:

  <button (click)="onLogin()">Login</button>
  <button (click)="onLogout()">Logout</button>
  <ul *ngIf="auth.user$ | async as user">
    <li>{{ }}</li>
    <li>{{ }}</li>

So here is what happens: Pressing the Login-Button => everything works. I get redirected to Auth0 and login. BUT it is not possible to show the information provided with etc.

Any help is very much appreciated!!!

Hello! Welcome to the Auth0 Community. Thanks for investing time on reading that blog post. We have created a new developer guide that covers how to implement Auth0 with Angular Standalone components:

I recommend following that guide, please, as the “Complete Guide” has been deprecated.

Please let me us know if you have any further questions after checking out that new guide.

1 Like

Access to XMLHttpRequest at ‘’ (redirected from ‘http://localhost:3000/api/message’) from origin ‘http://localhost:4200’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.

hi team,

kindly please try to help me .when i working with SAML authentication using with IDP as autho and SP is frontend application is Angular and my backend is Node.js.when i calling the backend from Angular. iam getting above error(cors policy error).i tried too many different ways. i fedup to solve this error.please try to give me reply. tqs team.

Is the project running on localhost:3000 using Auth0 to secure it as well? If so, is it using SAML or OIDC? My guess is the “messages” API is secured by OAuth and you need to do two things:

  1. Modify the messages API to allow cross-origin requests from localhost:4200.
  2. Change your Angular frontend to use OIDC instead of SAML. Use the access token retrieved to talk to your backend.
1 Like

Hey @dan-auth0, I am using implicit flow for the authentication purpose in angular to but I am not getting a refresh token using that flow or using the checkSession method my access token is not renewing automatically in the background so because of that after the access token expires all APIs are failing and giving 401 error.

I want to generate a new access token before the token expires so my api calls will not fail.
So can you provide some solution on this?