Skip to content

tanviet/angularjs-authentication-with-auth0

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AngularJS Authentication with Auth0

This repo shows how to implement authentication in an AngularJS 1.x application with Auth0.

Installation and Running the App

Clone the repo, then:

npm install
npm install -g http-server
npm install -g nodemon

You will need an Auth0 account to run the example. Sign up for a free account and then go to your dashboard to get your credentials.

Do not forget to add http://localhost:8080 into Allowed Origins (CORS) section in Settings page of the application which you are using.

Enter your domain and client ID for the front end.

// client/app.js

...

// Initialize Auth0 configuration
authProvider.init({
  domain: 'YOUR_AUTH0_DOMAIN',
  clientID: 'YOUR_AUTH0_CLIENT_ID'
});

...

Then enter your client ID and client secret for the express-jwt middleware in the backend.

// server/server.js

...

var authCheck = jwt({
  secret: new Buffer('YOUR_AUTH0_SECRET', 'base64'),
  audience: 'YOUR_AUTH0_CLIENT_ID'
});

...

With your credentials in place, you can run the app.

# Run the server
nodemon server/server.js

# Run the front-end (in a new console tab)
cd ..
http-server

And eventually you open the browser and access the address http://localhost:8080/#/home to see the app

About

This repo shows how to implement authentication in an AngularJS 1.x application with Auth0.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published