auth0-blog / pet-adoption-system

This is the sample project for creating custom CLI schematics with Nx.
6 stars 2 forks source link

Pet Adoption System

This is the sample project for the Auth0 blog post Create Your First Custom Schematic with Nx.

This project was generated with Angular CLI using Nrwl Nx. Both the Angular CLI and Nx are version 7+.

Quick Start & Documentation

Watch a 5-minute video on how to get started with Nx.

Generate your first application

Run ng generate app myapp to generate an application. When using Nx, you can create multiple applications and libraries in the same CLI workspace. Read more here.

Development server

Run ng serve --project=myapp for a dev server. Navigate to http://localhost:4200/. The app will automatically reload if you change any of the source files.

Code scaffolding

Run ng generate component component-name --project=myapp to generate a new component. You can also use ng generate directive|pipe|service|class|guard|interface|enum|module.

Build

Run ng build --project=myapp to build the project. The build artifacts will be stored in the dist/ directory. Use the --prod flag for a production build.

Running unit tests

Run ng test to execute the unit tests via Karma.

Running end-to-end tests

Run ng e2e to execute the end-to-end tests via Protractor. Before running the tests make sure you are serving the app via ng serve.

Further help

To get more help on the Angular CLI use ng help or go check out the Angular CLI README.

Using Auth0 for Authentication

We recommend using Auth0 to manage authentication for this project.

Sign Up for Auth0

You'll first need to sign up for an Auth0 account. You can sign up for a free Auth0 account here.

Set Up an Application

Once you've got your account, you can set up an application to use with this project. We'll set up a Single Page Application (SPA) in Auth0 in these steps.

Here's how to set that up:

  1. Go to your Auth0 Applications and click the "Create Application" button.
  2. Name your new app, select "Single Page Web Applications," and click the "Create" button. You can skip the Quick Start and click on Settings.
  3. In the Settings for your new Auth0 app, add http://localhost:4200/callback to the Allowed Callback URLs. (We're using localhost:4200 since it's the default port for the Angular CLI serve command.)
  4. Add http://localhost:4200 to the Allowed Logout URLs.
  5. Click the "Save Changes" button.
  6. Copy down your Domain and Client ID. We'll use them in just a minute.
  7. 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 utilizes username/password database, Facebook, Google, and Twitter.

Note: Under the OAuth tab of Advanced Settings (at the bottom of the Settings section) you should see that the JsonWebToken Signature Algorithm is set to RS256. This is the default for new applications. If it is set to HS256, please change it to RS256. You can read more about RS256 vs. HS256 JWT signing algorithms here.

What is Auth0?

Auth0 helps you to:

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.

Author

Auth0

License

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