All Projects → oktadev → okta-angular-openid-connect-example

oktadev / okta-angular-openid-connect-example

Licence: Apache-2.0 License
Angular + Angular CLI with Authentication from OpenID Connect and Okta

Programming Languages

typescript
32286 projects
HTML
75241 projects
javascript
184084 projects - #8 most used programming language
CSS
56736 projects

Projects that are alternatives of or similar to okta-angular-openid-connect-example

okta-angular-sign-in-widget-example
Angular + Okta Sign-In Widget Example
Stars: ✭ 17 (-10.53%)
Mutual labels:  angular-cli, okta
okta-api-center
Get up and running quickly with Okta's OAuth as a Service and your favorite API Gateway.
Stars: ✭ 58 (+205.26%)
Mutual labels:  okta, okta-api
mock-oauth2-server
A scriptable/customizable web server for testing HTTP clients using OAuth2/OpenID Connect or applications with a dependency to a running OAuth2 server (i.e. APIs requiring signed JWTs from a known issuer)
Stars: ✭ 83 (+336.84%)
Mutual labels:  openid-connect
clisso
Get temporary credentials for cloud providers from the command line.
Stars: ✭ 34 (+78.95%)
Mutual labels:  okta
ThinkApp
Test your knowledge with any of the available topic this fun and free Champion Quiz Master App. Save your time and effort by saving your queries & its resolutions
Stars: ✭ 15 (-21.05%)
Mutual labels:  angular-cli
ng-universal-module
This is a Hapiness Engine for running Angular Apps on the server for server side rendering.
Stars: ✭ 18 (-5.26%)
Mutual labels:  angular-cli
secure-oauth2-oidc-workshop
Hands-On Workshop for OAuth 2.0 and OpenID Connect 1.0
Stars: ✭ 58 (+205.26%)
Mutual labels:  openid-connect
workos-node
Official Node SDK for interacting with the WorkOS API
Stars: ✭ 42 (+121.05%)
Mutual labels:  okta
oxd
Client software to secure apps with OAuth 2.0, OpenID Connect, and UMA
Stars: ✭ 40 (+110.53%)
Mutual labels:  openid-connect
okta-ionic-auth-example
Example showing Ionic Authentication with Okta
Stars: ✭ 23 (+21.05%)
Mutual labels:  okta
yak
A tool to log in to AWS through Okta
Stars: ✭ 38 (+100%)
Mutual labels:  okta
loopback3 angular6 bootstrap4
API Rest build by Loopback. Frontend on Angular 6
Stars: ✭ 26 (+36.84%)
Mutual labels:  angular-cli
Expenses
Keep track of your expenses the smart way 💰
Stars: ✭ 15 (-21.05%)
Mutual labels:  angular-cli
fire-starter
Starter kit for the fireloop.io platform
Stars: ✭ 16 (-15.79%)
Mutual labels:  angular-cli
electron-angular-ngrx
An Angular (6x) Electron seed featuring @angular/cli, @ngrx/platform, and Typescript. Complete with HMR workflow
Stars: ✭ 39 (+105.26%)
Mutual labels:  angular-cli
angular-unit-testing-examples
Showroom for different Angular unit testing concepts
Stars: ✭ 19 (+0%)
Mutual labels:  angular-cli
okta-spring-security-5-example
Authentication with Spring Security 5 and Okta OIDC
Stars: ✭ 16 (-15.79%)
Mutual labels:  okta
ng-electron-devkit
Angular Webpack Build Facade for Electron
Stars: ✭ 12 (-36.84%)
Mutual labels:  angular-cli
ngx-deploy-docker
Deploy your Angular Application to a Docker registry directly from the Angular CLI! 🚀
Stars: ✭ 14 (-26.32%)
Mutual labels:  angular-cli
haskell-oidc-client
OpenID Connect 1.0 client (RP) library for Haskell
Stars: ✭ 23 (+21.05%)
Mutual labels:  openid-connect

Angular Authentication with OpenID Connect and Okta

This example app shows how to use angular-oauth2-oidc and the Okta Auth SDK to perform authentication in an Angular app.

Please read Angular Authentication with OpenID Connect and Okta in 20 Minutes to learn how to create this application.

This project was generated with Angular CLI version 6.0.0.

Okta has Authentication and User Management APIs that reduce development time with instant-on, scalable user infrastructure. Okta's intuitive API and expert support make it easy for developers to authenticate, manage and secure users and roles in any application.

Getting Started

To install this example application, run the following commands:

git clone https://github.com/oktadeveloper/okta-angular-openid-connect-example.git
cd okta-angular-openid-connect-example
npm install

This will get a copy of the project installed locally, install all of its dependencies and start the app.

Create an OIDC App in Okta

You will need to create an OIDC App in Okta to get your values to perform authentication.

OpenID Connect is built on top of the OAuth 2.0 protocol. It allows clients to verify the identity of the user and, as well as to obtain their basic profile information. To learn more, see http://openid.net/connect.

Login to your Okta account, or create one if you don't have one. Navigate to Applications and click on the Add Application button. Select SPA and click Next. On the next page, specify http://localhost:4200 as a Base URI, Login redirect URI, and Logout redirect URI. Click Done and copy the generated Client ID.

In src/app/app.component.ts, set the issuer and paste your clientId.

constructor(private oauthService: OAuthService) {
  this.oauthService.redirectUri = window.location.origin;
  this.oauthService.clientId = '{clientId}';
  this.oauthService.scope = 'openid profile email';
  this.oauthService.issuer = 'https://{yourOktaDomain}.com/oauth2/default';
  this.oauthService.tokenValidationHandler = new JwksValidationHandler();
  
  // Load Discovery Document and then try to login the user
  this.oauthService.loadDiscoveryDocumentAndTryLogin();
}

You'll also need to update the url in src/app/shared/auth/okta.auth.wrapper.ts.

constructor(private oauthService: OAuthService) {
  this.authClient = new OktaAuth({
    url: 'https://{yourOktaDomain}.com',
    issuer: 'default'
  });
}

NOTE: The value of {yourOktaDomain} should be something like dev-123456.oktapreview. Make sure you don't include -admin in the value!

After making these changes, you should be able to start the app (using ng serve) and log in with your credentials at http://localhost:4200.

Links

This example uses the following libraries provided by Okta:

It also uses the following library provided by Manfred Steyer:

Help

Please post any questions as comments on the blog post, or visit our Okta Developer Forums. You can also email [email protected] if would like to create a support ticket.

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

License

Apache 2.0, see LICENSE.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].