{"id":20307493,"url":"https://github.com/oktadev/angular-jwt-authentication-example","last_synced_at":"2025-07-31T19:34:48.493Z","repository":{"id":52809244,"uuid":"184144760","full_name":"oktadev/angular-jwt-authentication-example","owner":"oktadev","description":"Angular Authentication with JWT","archived":false,"fork":false,"pushed_at":"2021-04-18T16:53:46.000Z","size":204,"stargazers_count":10,"open_issues_count":0,"forks_count":6,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-03-25T11:21:30.456Z","etag":null,"topics":["angular","authentication","jwt","nodejs"],"latest_commit_sha":null,"homepage":"https://developer.okta.com/blog/2019/05/16/angular-authentication-jwt","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"holgerschmitz/jwt-authentication","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}},"created_at":"2019-04-29T21:10:55.000Z","updated_at":"2022-03-16T05:26:29.000Z","dependencies_parsed_at":"2023-01-14T11:31:02.890Z","dependency_job_id":null,"html_url":"https://github.com/oktadev/angular-jwt-authentication-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oktadev%2Fangular-jwt-authentication-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oktadev%2Fangular-jwt-authentication-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oktadev%2Fangular-jwt-authentication-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oktadev%2Fangular-jwt-authentication-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oktadev","download_url":"https://codeload.github.com/oktadev/angular-jwt-authentication-example/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248429110,"owners_count":21101783,"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","authentication","jwt","nodejs"],"created_at":"2024-11-14T17:17:54.005Z","updated_at":"2025-04-11T15:12:10.782Z","avatar_url":"https://github.com/oktadev.png","language":"TypeScript","readme":"# Angular Authentication with JWT\n \nThis example app shows how to build a JWT authentication with Node.js and Angular. It also shows how you can simplify JWT authentication by using Okta.\n\nPlease read [Angular Authentication with JWT](https://developer.okta.com/blog/2019/05/16/angular-authentication-jwt) to see how this app was created.\n\n**Prerequisites:** [Node.js](https://nodejs.org/). \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/angular-jwt-authentication-example.git\ncd angular-jwt-authentication-example\n```\n\nThis will get a copy of the project installed locally. There are a number of directories within this project:\n\n```\njwt-client\njwt-server\nokta-client\nokta-server\n```\n\nIf you'd like to run the bare-bones JWT examples (that doesn't use Okta), run `npm install` followed by `npm start` in the `jwt-server` and `jwt-client` directories. Make sure you do this in two separate terminal windows. You should then be able to register and authenticate at `http://localhost:4200`.\n\nTo run the Okta examples, you'll first need to create an OIDC app in Okta.\n\n### Create a New OIDC App in Okta\n\nIf you don't have an Okta developer account, please [create one](https://developer.okta.com/signup/). Then, create a new OIDC app on Okta:\n\n1. Log in to your developer account, navigate to **Applications** \u003e **Add Application**.\n3. Select **Single-Page App** \u003e **Next**. \n4. Give the application a name, change all instances of `https://localhost:8080` to `https://localhost:4200`, and click **Done**.\n\n#### Server Configuration\n\nSet your `issuer` and copy the `clientId` into `okta-server/auth.js`. \n\n```js\nconst oktaJwtVerifier = new OktaJwtVerifier({\n  issuer: 'https://{yourOktaDomain}/oauth2/default',\n  clientId: '{yourClientId}'\n});\n```\n\n**NOTE:** The value of `{yourOktaDomain}` should be something like `dev-123456.okta.com`. Make sure you don't include `-admin` in the value!\n\n#### Client Configuration\n\nFor the client, set the `issuer` and copy the `clientId` into `okta-client/src/app/app.module.ts`.\n\n```typescript\nconst oktaConfig = {\n  issuer: 'https://{yourOktaDomain}/oauth2/default',\n  redirectUri: 'http://localhost:4200/callback',\n  clientId: '{yourClientId}',\n  scope: 'openid profile'\n}\n```\n\nRun `npm install` followed by `npm start` in the `okta-server` and `okta-client` directories. Make sure you do this in two separate terminal windows. You should then be able to authenticate at `http://localhost:4200`.\n\n## Links\n\nThis example uses the following open source libraries from Okta:\n\n* [Okta Angular SDK](https://github.com/okta/okta-angular#readme)\n* [Okta JWT Verifier for Node.js](https://github.com/okta/okta-oidc-js/tree/master/packages/jwt-verifier#readme)\n\n## Help\n\nPlease post any questions as commnets on the [blog post](https://developer.okta.com/blog/2019/05/16/angular-authentication-jwt) or ask them on the [Okta Developer Forums](https://devforum.okta.com/). Our whole team monitors this channel and will see your questions. You can also enter them as issues on this project or ask them on Stack Overflow and add the `okta` tag.\n\n## License\n\nApache 2.0, see [LICENSE](LICENSE).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foktadev%2Fangular-jwt-authentication-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foktadev%2Fangular-jwt-authentication-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foktadev%2Fangular-jwt-authentication-example/lists"}