{"id":20307444,"url":"https://github.com/oktadev/okta-angular-openid-connect-example","last_synced_at":"2025-06-29T08:36:55.824Z","repository":{"id":103824005,"uuid":"87879272","full_name":"oktadev/okta-angular-openid-connect-example","owner":"oktadev","description":"Angular + Angular CLI with Authentication from OpenID Connect and Okta","archived":false,"fork":false,"pushed_at":"2019-04-28T13:07:56.000Z","size":2028,"stargazers_count":22,"open_issues_count":1,"forks_count":34,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-11T15:15:08.613Z","etag":null,"topics":["angular","angular-cli","okta","okta-api","openid-connect"],"latest_commit_sha":null,"homepage":"http://developer.okta.com/blog/2017/04/17/angular-authentication-with-oidc","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/oktadev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2017-04-11T02:31:18.000Z","updated_at":"2023-05-17T13:55:16.000Z","dependencies_parsed_at":null,"dependency_job_id":"6997226b-5006-4217-9f21-54607050aa51","html_url":"https://github.com/oktadev/okta-angular-openid-connect-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/oktadev/okta-angular-openid-connect-example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oktadev%2Fokta-angular-openid-connect-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oktadev%2Fokta-angular-openid-connect-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oktadev%2Fokta-angular-openid-connect-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oktadev%2Fokta-angular-openid-connect-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oktadev","download_url":"https://codeload.github.com/oktadev/okta-angular-openid-connect-example/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oktadev%2Fokta-angular-openid-connect-example/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262565673,"owners_count":23329653,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["angular","angular-cli","okta","okta-api","openid-connect"],"created_at":"2024-11-14T17:17:43.249Z","updated_at":"2025-06-29T08:36:55.799Z","avatar_url":"https://github.com/oktadev.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Angular Authentication with OpenID Connect and Okta\n\nThis example app shows how to use [angular-oauth2-oidc](https://github.com/manfredsteyer/angular-oauth2-oidc) and the \n[Okta Auth SDK](https://github.com/okta/okta-auth-js) to perform authentication in an Angular app.\n\nPlease read [Angular Authentication with OpenID Connect and Okta in 20 Minutes](http://developer.okta.com/blog/2017/04/17/angular-authentication-with-oidc) to learn how to create this application.\n\nThis project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 6.0.0.\n\n\u003e [Okta](https://developer.okta.com/) 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.\n\n* [Getting Started](#getting-started)\n* [Links](#links)\n* [Help](#help)\n* [License](#license)\n\n## Getting Started\n\nTo install this example application, run the following commands:\n\n```bash\ngit clone https://github.com/oktadeveloper/okta-angular-openid-connect-example.git\ncd okta-angular-openid-connect-example\nnpm install\n```\n\nThis will get a copy of the project installed locally, install all of its dependencies and start the app.\n\n### Create an OIDC App in Okta\n\nYou will need to [create an OIDC App in Okta](https://developer.okta.com/blog/2017/04/17/angular-authentication-with-oidc#create-an-openid-connect-app-in-okta) to get your values to perform authentication. \n\nOpenID 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](http://openid.net/connect/).\n\nLogin to your Okta account, or [create one](https://developer.okta.com/signup/) 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`.\n\nIn `src/app/app.component.ts`, set the `issuer` and paste your `clientId`.\n\n```typescript\nconstructor(private oauthService: OAuthService) {\n  this.oauthService.redirectUri = window.location.origin;\n  this.oauthService.clientId = '{clientId}';\n  this.oauthService.scope = 'openid profile email';\n  this.oauthService.issuer = 'https://{yourOktaDomain}.com/oauth2/default';\n  this.oauthService.tokenValidationHandler = new JwksValidationHandler();\n  \n  // Load Discovery Document and then try to login the user\n  this.oauthService.loadDiscoveryDocumentAndTryLogin();\n}\n```\n\nYou'll also need to update the `url` in `src/app/shared/auth/okta.auth.wrapper.ts`.\n\n```typescript\nconstructor(private oauthService: OAuthService) {\n  this.authClient = new OktaAuth({\n    url: 'https://{yourOktaDomain}.com',\n    issuer: 'default'\n  });\n}\n```\n\n**NOTE:** The value of `{yourOktaDomain}` should be something like `dev-123456.oktapreview`. Make sure you don't include `-admin` in the value!\n\nAfter making these changes, you should be able to start the app (using `ng serve`) and log in with your credentials at `http://localhost:4200`.\n\n## Links\n\nThis example uses the following libraries provided by Okta:\n\n* [Okta Auth SDK](https://github.com/okta/okta-auth-js)\n\nIt also uses the following library provided by [Manfred Steyer](https://github.com/manfredsteyer):\n\n* [angular-oauth2-oidc](https://github.com/manfredsteyer/angular-oauth2-oidc)\n\n## Help\n\nPlease post any questions as comments on the [blog post](http://developer.okta.com/blog/2017/04/17/angular-authentication-with-oidc), or visit our [Okta Developer Forums](https://devforum.okta.com/). You can also email developers@okta.com if would like to create a support ticket.\n\nTo 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).\n\n## License\n\nApache 2.0, see [LICENSE](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foktadev%2Fokta-angular-openid-connect-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foktadev%2Fokta-angular-openid-connect-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foktadev%2Fokta-angular-openid-connect-example/lists"}