{"id":20307377,"url":"https://github.com/oktadev/okta-ionic4-jhipster-example","last_synced_at":"2025-10-11T15:31:58.476Z","repository":{"id":103824276,"uuid":"193144507","full_name":"oktadev/okta-ionic4-jhipster-example","owner":"oktadev","description":"Ionic 4 JHipster Example App","archived":false,"fork":false,"pushed_at":"2020-05-20T18:15:01.000Z","size":7580,"stargazers_count":7,"open_issues_count":1,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-23T11:14:35.546Z","etag":null,"topics":["angular","ionic","ionic4","jhipster","spring-boot"],"latest_commit_sha":null,"homepage":"https://developer.okta.com/blog/2019/06/24/ionic-4-angular-spring-boot-jhipster","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}},"created_at":"2019-06-21T18:37:33.000Z","updated_at":"2021-01-20T02:59:14.000Z","dependencies_parsed_at":"2023-07-03T09:00:39.093Z","dependency_job_id":null,"html_url":"https://github.com/oktadev/okta-ionic4-jhipster-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/oktadev/okta-ionic4-jhipster-example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oktadev%2Fokta-ionic4-jhipster-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oktadev%2Fokta-ionic4-jhipster-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oktadev%2Fokta-ionic4-jhipster-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oktadev%2Fokta-ionic4-jhipster-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oktadev","download_url":"https://codeload.github.com/oktadev/okta-ionic4-jhipster-example/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oktadev%2Fokta-ionic4-jhipster-example/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279007604,"owners_count":26084334,"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","status":"online","status_checked_at":"2025-10-11T02:00:06.511Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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","ionic","ionic4","jhipster","spring-boot"],"created_at":"2024-11-14T17:17:29.535Z","updated_at":"2025-10-11T15:31:58.442Z","avatar_url":"https://github.com/oktadev.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Build Mobile Apps with Ionic 4 and JHipster 6\n\nThis example shows how to create an Ionic 4 application that talks to a JHipster 6 backend.\n\nPlease read [Build Mobile Apps with Angular, Ionic 4, and Spring Boot](https://developer.okta.com/blog/2019/06/24/ionic-4-angular-spring-boot-jhipster) to see how this example was created.\n\n**Prerequisites:** Java 8+ and [Node.js](https://nodejs.org/) 10+.\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-ionic4-jhipster-example.git ionic4-jhipster\ncd ionic4-jhipster\n```\n\nThis will get a copy of the project installed locally. \n\n### Create an OIDC App on Okta\n\nTo begin, sign up for a [forever-free Okta developer account](https://developer.okta.com/signup/).\n\nOnce you're signed in to Okta, register your JHipster application.\n\n* In the top menu, click on **Applications**\n* Click on **Add Application**\n* Select **Web** and click **Next**\n* Enter `JHipster FTW!` for the **Name** (this value doesn't matter, so feel free to change it)\n* Change the Login redirect URI to be `http://localhost:8080/login/oauth2/code/oidc`\n* Click **Done**, then **Edit** and add `http://localhost:8080` as a Logout redirect URI\n* Click **Save**\n\n### Add a Groups Claim to the ID Token\n\nIn order to login to your JHipster app, you'll need to adjust your Okta authorization server to include a `groups` claim.\n\nOn Okta, navigate to **Users** \u003e **Groups**. Create `ROLE_ADMIN` and `ROLE_USER` groups and add your account to them.\n\nNavigate to **API** \u003e **Authorization Servers**, click the **Authorization Servers** tab and edit the **default** one. Click the **Claims** tab and **Add Claim**. Name it \"groups\" or \"roles\" and include it in the ID Token. Set the value type to \"Groups\" and set the filter to be a Regex of `.*`. Click **Create**.\n\n### Run the JHipster API\n\nOpen a terminal, navigate to the `app` directory and run the following command:\n\n```\nSPRING_SECURITY_OAUTH2_CLIENT_PROVIDER_OIDC_ISSUER_URI=https://{yourOktaDomain}/oauth2/default \\\n  SPRING_SECURITY_OAUTH2_CLIENT_REGISTRATION_OIDC_CLIENT_ID=$clientId \\\n  SPRING_SECURITY_OAUTH2_CLIENT_REGISTRATION_OIDC_CLIENT_SECRET=$clientSecret ./gradlew\n```\n\n### Add a Native App for Ionic\n\nYou'll also need to create a Native app for Ionic. \n\n* In the Okta developer console, click on **Applications**\n* Click on **Add Application**\n* Select **Native** and click **Next**\n* Enter `Ionic FTW!` for the Name\n* Add Login redirect URIs: `http://localhost:8100/callback` and `dev.localhost.ionic:/callback`\n* Click **Done**, then **Edit** and add Logout redirect URIs: `http://localhost:8100/logout` and `dev.localhost.ionic:/logout`\n* Click **Save**\n\nAfter performing these steps, copy your `clientId` into [`src/app/auth/auth.service.ts`](https://github.com/oktadeveloper/okta-ionic4-jhipster-example/blob/master/mobile/src/app/auth/auth.service.ts#L59).\n\n```typescript\nthis.requestor.xhr({method: 'GET', url: AUTH_CONFIG_URI}).then(async (data: any) =\u003e {\n  this.authConfig = {\n    identity_client: '{yourClientId}',\n    identity_server: data.issuer,\n    redirect_url: redirectUri,\n    end_session_redirect_url: logoutRedirectUri,\n    scopes,\n    usePkce: true\n  };\n  await this.storage.setItem(AUTH_CONFIG_URI, JSON.stringify(this.authConfig));\n}\n```\n\n### Add Claims to Access Token\n\nIn order to authentication successfully with your Ionic app, you have to do a bit more configuration in Okta. Since the Ionic client will only send an access token to JHipster, you need to 1) add a `groups` claim to the access token and 2) add a couple more claims so the user's name will be available in JHipster.\n\nNavigate to **API** \u003e **Authorization Servers**, click the **Authorization Servers** tab and edit the **default** one. Click the **Claims** tab and **Add Claim**. Name it \"groups\" and include it in the Access Token. Set the value type to \"Groups\" and set the filter to be a Regex of `.*`. Click **Create**.\n\nAdd another claim, name it `given_name`, include it in the access token, use `Expression` in the value type, and set the value to `user.firstName`. Optionally, include it in the `profile` scope. Perform the same actions to create a `family_name` claim and use expression `user.lastName`.\n\n### Run Your Ionic App\n\nNow you should be able to open another terminal window, navigate to the `mobile` directory, and run the Ionic app.\n\n```\nionic serve\n```\n\n## Links\n\nThis example uses the following libraries provided by Okta:\n\n* [Ionic for JHipster](https://github.com/oktadeveloper/generator-jhipster-ionic#readme)\n\n## Help\n\nPlease post any questions on the [associated blog post](https://developer.okta.com/blog/2019/06/24/ionic-4-angular-spring-boot-jhipster) or on the [Okta Developer Forums](https://devforum.okta.com/). \n\n## License\n\nApache 2.0, see [LICENSE](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foktadev%2Fokta-ionic4-jhipster-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foktadev%2Fokta-ionic4-jhipster-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foktadev%2Fokta-ionic4-jhipster-example/lists"}