GithubHelp home page GithubHelp logo

isabella232 / auth0-angular-example Goto Github PK

View Code? Open in Web Editor NEW

This project forked from oktadev/auth0-angular-example

0.0 0.0 0.0 218 KB

Angular + Auth0 Example

Home Page: https://auth0.com/blog/add-oidc-to-angular-apps-quickly/

License: Apache License 2.0

JavaScript 4.14% TypeScript 26.07% CSS 0.23% HTML 69.56%

auth0-angular-example's Introduction

Angular OpenID Connect with Auth0 Example

This example shows you how to integrate OpenID Connect authentication with Angular and Auth0.

Please read Add OpenID Connect to Angular Apps Quickly to see how this app was created.

Prerequisites:

Auth0 is an easy to implement, adaptable authentication and authorization platform. Basically, we make your login box awesome.

Getting Started

To install this example, clone it.

git clone https://github.com/oktadev/auth0-angular-example.git
cd auth0-angular-example

Create an OIDC App on Auth0

To add authentication with Auth0, you'll first need a free Auth0 account. Install the Auth0 CLI and run auth0 login to register your account. Then, run auth0 apps create. Specify a name and description of your choosing. Choose Single Page Web Application and use http://localhost:4200/home for the Callback URL. Specify http://localhost:4200 for the rest of the URLs.

You can also use the Auth0 Console:

  • Log in to Auth0 or create an account if you don't have one. Go to Applications > Create Application.
  • Choose Single Page Web Applications as the application type and click Create.
  • Click Angular, then the Settings tab.
  • Add http://localhost:4200/home as an Allowed Callback URL and http://localhost:4200 as a Logout URL.
  • Specify http://localhost:4200 as an Allowed Origin and click Save Changes at the bottom.

Modify src/app/auth-routing.module.ts to add your Auth0 OIDC settings:

const config = {
  domain: 'YOUR-AUTH0-DOMAIN',
  clientId: 'YOUR-AUTH0-CLIENT-ID',
  redirectUri: window.location.origin + '/home',
  httpInterceptor: {
    allowedList: ['/api/*']
  },
};

Run ng serve in your app, and you should see a login button at http://localhost:4200/home.

Links

This example uses the following open source libraries:

Help

Please post any questions as comments on the blog post.

License

Apache 2.0, see LICENSE.

auth0-angular-example's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.