sample-auth0-angular
Implement Auth0 and secure an Angular application with an authenticated Node.js API.
Angular Tutorial
To begin, proceed to Auth0 Angular Workshop to follow along with the tutorial.
Using This Repo
If you want to clone and run this repo, you will need:
Requirements
- Node.js and npm
- Angular CLI, installed globally
- A free Auth0 account
- The sample-auth0-nodeserver, configured according to the README instructions
- An Auth0 client, configured as specified here
Clone the Repo
Once you have all the above requirements fulfilled, clone this repo and install its dependencies:
git clone https://github.com/kmaida/sample-auth0-angular.git
cd sample-auth0-angular
npm install
Configure Environment
Locate the environment.ts.sample
file and change its filename to environment.ts
to activate the file. Then add the necessary Auth0 configuration to the environment variable as described here.
Serve the App
Serve the app by running:
ng serve
The app will be available at http://localhost:4200.
Important: Make sure you have the sample-auth0-nodeserver running to provide API data for the Angular app.
Deploying to Heroku
Make sure you have Heroku for Node installed on your machine. Create a new Heroku app in the root of this project.
heroku create
When all changes have been pushed to the main repository for the app, push to Heroku to start an automatic build.
git push heroku master
The app will be served using the small express server in server.js
.
License
MIT © Kim Maida 2018