|
| 1 | +# Auth0 Angular SDK sample |
| 2 | + |
| 3 | +This sample app demonstrates the integration of the [Auth0 Angular SDK](https://github.com/auth0/auth0-angular) into an Angular application created using the Angular CLI. This sample is a companion to the [Auth0 Angular SDK Quickstart](https://auth0.com/docs/quickstart/spa/angular). |
| 4 | + |
| 5 | +This sample demonstrates the following use cases: |
| 6 | + |
| 7 | +- Login |
| 8 | +- Log out |
| 9 | +- Showing the user profile |
| 10 | +- Protecting routes using the authentication guard |
| 11 | +- Calling APIs with automatically-attached bearer tokens |
| 12 | + |
| 13 | +## Configuration |
| 14 | + |
| 15 | +The sample needs to be configured with your Auth0 domain and client ID in order to work. In the root of the sample, copy `auth_config.json.example` and rename it to `auth_config.json`. Open the file and replace the values with those from your Auth0 tenant: |
| 16 | + |
| 17 | +```json |
| 18 | +{ |
| 19 | + "domain": "<YOUR AUTH0 DOMAIN>", |
| 20 | + "clientId": "<YOUR AUTH0 CLIENT ID>", |
| 21 | + "audience": "<YOUR AUTH0 API AUDIENCE IDENTIFIER>" |
| 22 | +} |
| 23 | +``` |
| 24 | + |
| 25 | +## Development server |
| 26 | + |
| 27 | +Run `npm run dev` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files. |
| 28 | + |
| 29 | +This will automatically start a Node + Express server as the backend on port `3001`. The Angular application is configured to proxy through to this on any `/api` route. |
| 30 | + |
| 31 | +## Build |
| 32 | + |
| 33 | +Run `npm build` to build the project. The build artifacts will be stored in the `dist/login-demo` directory. Use the `--prod` flag for a production build. |
| 34 | + |
| 35 | +To build and run a production bundle and serve it, run `npm run prod`. The application will run on `http://localhost:3000`. |
| 36 | + |
| 37 | +## Run Using Docker |
| 38 | + |
| 39 | +You can build and run the sample in a Docker container by using the provided scripts: |
| 40 | + |
| 41 | +```bash |
| 42 | +# In Linux / MacOS |
| 43 | +sh exec.sh |
| 44 | + |
| 45 | +# Windows Powershell |
| 46 | +./exec.ps1 |
| 47 | +``` |
| 48 | + |
| 49 | +## Further help |
| 50 | + |
| 51 | +To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md). |
| 52 | + |
| 53 | +## Frequently Asked Questions |
| 54 | + |
| 55 | +We are compiling a list of questions and answers regarding the new JavaScript SDK - if you're having issues running the sample applications, [check the FAQ](https://github.com/auth0/auth0-spa-js/blob/master/FAQ.md)! |
| 56 | + |
| 57 | +# What is Auth0? |
| 58 | + |
| 59 | +Auth0 helps you to: |
| 60 | + |
| 61 | +- Add authentication with [multiple authentication sources](https://auth0.com/docs/identityproviders), either social like **Google, Facebook, Microsoft Account, LinkedIn, GitHub, Twitter, Box, Salesforce, among others**, or enterprise identity systems like **Windows Azure AD, Google Apps, Active Directory, ADFS or any SAML Identity Provider**. |
| 62 | +- Add authentication through more traditional **[username/password databases](https://auth0.com/docs/connections/database/custom-db/create-db-connection)**. |
| 63 | +- Add support for **[linking different user accounts](https://auth0.com/docs/users/user-account-linking)** with the same user. |
| 64 | +- Support for generating signed [Json Web Tokens](https://auth0.com/docs/tokens/json-web-tokens) to call your APIs and **flow the user identity** securely. |
| 65 | +- Analytics of how, when and where users are logging in. |
| 66 | +- Pull data from other sources and add it to the user profile, through [JavaScript rules](https://auth0.com/docs/rules). |
| 67 | + |
| 68 | +## Create a Free Auth0 Account |
| 69 | + |
| 70 | +1. Go to [Auth0](https://auth0.com/signup) and click Sign Up. |
| 71 | +2. Use Google, GitHub or Microsoft Account to login. |
| 72 | + |
| 73 | +## Issue Reporting |
| 74 | + |
| 75 | +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](https://auth0.com/whitehat) details the procedure for disclosing security issues. |
| 76 | + |
| 77 | +## Author |
| 78 | + |
| 79 | +[Auth0](https://auth0.com) |
| 80 | + |
| 81 | +## License |
| 82 | + |
| 83 | +This project is licensed under the MIT license. See the [LICENSE](../LICENSE) file for more info. |
0 commit comments