Skip to content

bitsmuggler/auth0-angular-authentication-example

Repository files navigation

Auth0 Angular Example (Authorization Code Flow)

Netlify Status

This example shows Auth0 client authentication with Angular. It's the Authorization Code Flow.

👉 Demo

👉 Under the hood Authorization Code Grant

Configuration Auth0

  • Register and setup your tenant
  • Create an application Applications > Create Application > Type "Single Page Web Applications"
  • Set the following attributes
    • Allowed Callback URLs: http://localhost:4200
    • Allowed Logout URLs: http://localhost:4200
    • Allowed Web Origins: http://localhost:4200

Configuration Angular App

  • Edit environment.ts
    • auth0ClientDomainto app domain (Application Settings > Basic Information > Domain)
    • auth0ClientId to app client id (Application Settings > Basic Information > Client Id)

Run it

  • Install dependencies npm install (+ probably the ng cli npm install -g @angular/cli or run the serve commandvia npx)
  • Run ng serve

Resources