{"id":20307271,"url":"https://github.com/oktadev/okta-spring-boot-angular-auth-code-flow-example","last_synced_at":"2025-04-11T15:10:30.532Z","repository":{"id":38814127,"uuid":"136567454","full_name":"oktadev/okta-spring-boot-angular-auth-code-flow-example","owner":"oktadev","description":"Package Angular and Spring Boot into a single JAR!","archived":false,"fork":false,"pushed_at":"2023-02-27T23:40:40.000Z","size":854,"stargazers_count":13,"open_issues_count":3,"forks_count":5,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-25T11:11:33.349Z","etag":null,"topics":["angular","frontend-maven-plugin","jar","java","maven","oauth2","pwa","spring-boot"],"latest_commit_sha":null,"homepage":"https://developer.okta.com/blog/2018/06/18/spring-boot-angular-auth-code-flow","language":"Java","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}},"created_at":"2018-06-08T04:44:18.000Z","updated_at":"2024-04-18T12:47:17.000Z","dependencies_parsed_at":"2023-01-24T12:00:53.274Z","dependency_job_id":null,"html_url":"https://github.com/oktadev/okta-spring-boot-angular-auth-code-flow-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%2Fokta-spring-boot-angular-auth-code-flow-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oktadev%2Fokta-spring-boot-angular-auth-code-flow-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oktadev%2Fokta-spring-boot-angular-auth-code-flow-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oktadev%2Fokta-spring-boot-angular-auth-code-flow-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oktadev","download_url":"https://codeload.github.com/oktadev/okta-spring-boot-angular-auth-code-flow-example/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248429104,"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","frontend-maven-plugin","jar","java","maven","oauth2","pwa","spring-boot"],"created_at":"2024-11-14T17:17:00.025Z","updated_at":"2025-04-11T15:10:30.496Z","avatar_url":"https://github.com/oktadev.png","language":"Java","readme":"# Spring Boot, Angular, and OAuth's 🥇 Standard: Authorization Code Flow!\n \nThis example app shows how to use [Spring Boot](https://spring.io/projects/spring-boot) and [Angular](https://angular.io) in a singular artifact.\n\n\u003e Make JAR, not WAR! -- [Josh Long](https://twitter.com/starbuxman)\n\nIf you want to be a kick-ass developer, you should write tests. I know it sucks and it seems like it sucks the life out of you, but it's totally worthwhile in the end. If you expect a system or example to live on the internet for more than a year, it needs automated nightly tests to prove it.\n\nPlease read [Deploy Your Secure Spring Boot + Angular PWA as a Single Artifact](https://developer.okta.com/blog/2018/06/18/spring-boot-angular-auth-code-flow) to learn more about the app you're about to make into an _awesome artifact_.\n\n**Prerequisites:** [Java 8](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html) and [Node.js](https://nodejs.org/).\n\n\u003e Note: I challenge you to install Java 11 and make it work with this example. I'll send you a free 🍺 somehow!\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-spring-boot-angular-auth-code-flow-example.git spring-rocks\ncd spring-rocks\n```\n\nThis will get a copy of the project installed locally. To install all of its dependencies and start each app, follow the instructions below.\n\nTo run the server, cd into the `holdings-api` directory and run:\n \n```bash\n./mvnw spring-boot:run\n```\n\nTo run the client, cd into the `crypto-pwa` directory and run:\n \n```bash\nnpm install -g ionic\nnpm i \u0026\u0026 ionic serve\n```\n\nTo package everything into a single JAR for deployment, run the following command in the `holdings-api` directory.\n\n```bash\n./mvnw package -Pprod\n```\n\n### Setup Okta\n\nThe first thing you’ll need to do is add a `holdings` attribute to your organization’s user profiles. Log in to the Okta Developer Console, then navigate to **Users** \u003e **Profile Editor**. Click on **Profile** for the first profile in the table. You can identify it by its Okta logo. Click **Add Attribute** and use the following values:\n\n* Display name: `Holdings`\n* Variable name: `holdings`\n* Description: `Cryptocurrency Holdings`\n\nYou will need to [create an API Token and OIDC App](https://developer.okta.com/blog/2018/01/23/replace-local-storage-with-okta-profile-attributes#create-an-api-token) to get your values to perform authentication. \n\nLog in to your Okta Developer account (or [sign up](https://developer.okta.com/signup/) if you don’t have an account) and navigate to **Applications** \u003e **Add Application**. Click **Web**, click **Next**, give the app a name you’ll remember, and specify `http://localhost:8080/login` as a login redirect URI and `http://localhost:8080` as a logout redirect URI. Click **Done**.\n\nFor the Okta Java SDK to talk to Okta’s API, you’ll need to create an API token. The abbreviated steps are as follows:\n\n1. Log in to your Developer Console\n2. Navigate to **API** \u003e **Tokens** and click **Create Token**\n3. Give your token a name, then copy its value\n\n#### Okta App Configuration\n\nOpen `holdings-api/src/main/resources/application.yml` and add your API token as a property. While you're there, set the `issuer` and `clientId` to match your OIDC application.\n\n**NOTE:** The value of `{yourOktaDomain}` should be something like `dev-123456.oktapreview.com`. Make sure you don't include `-admin` in the value!\n\n```properties\nokta:\n  client:\n    orgUrl: https://{yourOktaDomain}.com\n    token: XXX\nsecurity:\n    oauth2:\n        client:\n            access-token-uri: https://{yourOktaDomain}.com/oauth2/default/v1/token\n            user-authorization-uri: https://{yourOktaDomain}.com/oauth2/default/v1/authorize\n            client-id: {yourClientId}\n            client-secret: {yourClientSecret}\n            scope: openid profile email\n        resource:\n            user-info-uri: https://{yourOktaDomain}.com/oauth2/default/v1/userinfo\n```\n\n\u003c!-- okta.oauth2.orgUrl=https://{yourOktaDomain}.com\nokta.oauth2.issuer=https://{yourOktaDomain}.com/oauth2/default\nokta.oauth2.clientId={yourClientId}\nokta.client.token=XXX --\u003e\n## Links\n\nThis example uses the following libraries provided by Okta:\n\n* [Okta Spring Boot Starter](https://github.com/okta/okta-spring-boot)\n* [Okta Auth SDK](https://github.com/okta/okta-auth-js)\n\n## Help\n\nPlease post any questions as comments on the [blog post](https://developer.okta.com/blog/2018/06/18/spring-boot-angular-auth-code-flow), 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\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%2Fokta-spring-boot-angular-auth-code-flow-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foktadev%2Fokta-spring-boot-angular-auth-code-flow-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foktadev%2Fokta-spring-boot-angular-auth-code-flow-example/lists"}