Skip to content
Aside: Angular with Auth0 and an authenticated Node API.
Branch: master
Clone or download
Latest commit d9901b6 Jun 5, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
.vscode Initial commit. Apr 11, 2017
e2e chore: initial commit from @angular/cli Apr 11, 2017
server Minor indentation cleanup fix Sep 16, 2018
src Update to Angular 8 Jun 5, 2019
.editorconfig chore: initial commit from @angular/cli Apr 11, 2017
.gitignore Update auth service to implement observables Aug 31, 2018
LICENSE README, clean up vars, package.json, etc. Apr 12, 2017 Update readme with new versions Jun 5, 2019
browserslist Update to Angular 8 Jun 5, 2019
karma.conf.js Upgrade to Angular 6 / CLI 6 / RxJS 6.1 May 4, 2018
package-lock.json Update to Angular 8 Jun 5, 2019
package.json Update to Angular 8 Jun 5, 2019
protractor.conf.js chore: initial commit from @angular/cli Apr 11, 2017
tsconfig.json Update to Angular 8 Jun 5, 2019
tslint.json Update to Angular 8 Jun 5, 2019


This repository demonstrates the use of Auth0 with Angular (with the @angular/cli) and a sample Node API with a protected route.


Auth0 Application Setup

  1. Go to your Auth0 Dashboard: Applications section and click the "+ Create Application" button.
  2. Name your new app and select "Single Page Web Applications".
  3. In the Settings for your new Auth0 app, add http://localhost:4200/callback to the Allowed Callback URLs.
  4. Add http://localhost:4200 to both the Allowed Web Origins and Allowed Logout URLs. Click the "Save Changes" button.
  5. If you'd like, you can set up some social connections. You can then enable them for your app in the Application options under the Connections tab. The example shown in the screenshot above uses username/password database, Facebook, Google, and Twitter.

Note: Set up your own social keys and do not leave social connections set to use Auth0 dev keys or you will encounter issues with token renewal.

Auth0 API Setup

  1. Go to APIs in your Auth0 dashboard and click on the "Create API" button. Enter a name for the API. Set the Identifier to your API endpoint URL. In this example, this is http://localhost:3001/api/. The Signing Algorithm should be RS256.
  2. You can consult the Node.js example under the Quick Start tab in your new API's settings. We'll implement our Node API in this fashion, using Express, express-jwt, and jwks-rsa.

We're now ready to implement Auth0 authentication on both our Angular client and Node backend API.


Clone this project. From the root directory, run the following commands to install dependencies for the server and client-side:

$ npm install
$ cd server
$ npm install
  1. Open server/config.js.example and remove .example from the file name. Then replace [YOUR_AUTH0_DOMAIN] with your Auth0 domain.
  2. Open src/app/environments/environment.example and remove .example from the file name. Then replace [YOUR_CLIENT_ID] and [YOUR_AUTH0_DOMAIN] with your Auth0 application's client ID and domain.

Serving the project

From the root of this project, run:

$ npm start

This will concurrently serve the Angular and API servers.

What is Auth0?

Auth0 helps you to:

  • Add authentication with multiple authentication sources, either social like Google, Facebook, Microsoft Account, LinkedIn, GitHub, Twitter, Box, Salesforce, amont others, or enterprise identity systems like Windows Azure AD, Google Apps, Active Directory, ADFS or any SAML Identity Provider.
  • Add authentication through more traditional username/password databases.
  • Add support for linking different user accounts with the same user.
  • Support for generating signed Json Web Tokens to call your APIs and flow the user identity securely.
  • Analytics of how, when and where users are logging in.
  • Pull data from other sources and add it to the user profile, through JavaScript rules.

Create a Free Auth0 Account

  1. Go to Auth0 and click Sign Up.
  2. Use Google, GitHub, or Microsoft Account to log in.

Issue Reporting

If you have found a bug or if you have a feature request, please report them at this repository issues section. Please do not report security vulnerabilities on the public GitHub issue tracker. The Responsible Disclosure Program details the procedure for disclosing security issues.




This project is licensed under the MIT license. See the LICENSE file for more info.

You can’t perform that action at this time.