Angular Demo Project for OAuth2 login using Okta server
npm install @okta/okta-angular
@okta/okta-angular": "3.0.1"
- Create an Okta account
- Add your application to your Okta Console
- in your environment.ts/environment.prod.ts add
oktaConfig : {
issuer: 'https://*{serverAddress}/oauth2/default',
redirectUri: 'http://*{your app index path}/implicit/callback',
clientId: '*{client Id taken from the App registered in Okta console}',
pkce: true
}
- In your app.module.ts
imports: [
OktaAuthModule
],
providers: [
{ provide: OKTA_CONFIG, useValue: environment.oktaConfig },
],
- Use OktaAuthService and OktaAuthGuard directly
- Create your own authService and authGuard as wrapper to OktaAuthService
- see: authGuard and authService