{"id":22268156,"url":"https://github.com/curityio/ios-haapi-demo-app","last_synced_at":"2025-07-28T12:31:04.074Z","repository":{"id":53718365,"uuid":"344489475","full_name":"curityio/ios-haapi-demo-app","owner":"curityio","description":"An OpenID Connect iOS demo app using the HAAPI SDK","archived":false,"fork":false,"pushed_at":"2024-01-31T11:41:49.000Z","size":1708,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-01-31T12:45:25.172Z","etag":null,"topics":["code-example","haapi","ios","mobile","oauth2","openid-connect"],"latest_commit_sha":null,"homepage":"https://curity.io/resources/learn/swift-ios-haapi/","language":"Swift","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/curityio.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}},"created_at":"2021-03-04T13:47:37.000Z","updated_at":"2023-06-05T16:46:15.000Z","dependencies_parsed_at":"2022-09-23T13:24:12.159Z","dependency_job_id":"76f2168d-e411-4f6d-9ddb-9efb8d26e8b0","html_url":"https://github.com/curityio/ios-haapi-demo-app","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/curityio%2Fios-haapi-demo-app","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/curityio%2Fios-haapi-demo-app/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/curityio%2Fios-haapi-demo-app/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/curityio%2Fios-haapi-demo-app/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/curityio","download_url":"https://codeload.github.com/curityio/ios-haapi-demo-app/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227905532,"owners_count":17837906,"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":["code-example","haapi","ios","mobile","oauth2","openid-connect"],"created_at":"2024-12-03T11:11:42.425Z","updated_at":"2024-12-03T11:11:43.913Z","avatar_url":"https://github.com/curityio.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Demo Swift application which uses HAAPI\n\n[![Quality](https://img.shields.io/badge/quality-demo-red)](https://curity.io/resources/code-examples/status/)\n[![Availability](https://img.shields.io/badge/availability-source-blue)](https://curity.io/resources/code-examples/status/)\n\nThis is an example iOS app which uses the Curity Identity Server's Hypermedia API to perform an\nOAuth2 flow with authentication done completely from the app, without the need of an external browser.\n\nThis project highlights the usage of the [iOS HAAPI SDK](https://github.com/curityio/ios-idsvr-haapi-sdk-dist).\n\n## Getting started\n\n### Xcode\n\nYou need Xcode at least version 12.4 so that it supports iOS 14.\n\n### Swiftlint\n\nIf you want to use Swiftlint, you will need at least version 0.43.\n\n```\nbrew install swiftlint\n```\n\n### Docker Automated Setup\n\nThe required Curity Identity Server setup and connectivity from devices can be automated via a bash script:\n\n- Copy a license.json file into the code example root folder.\n- Run the `./start-idsvr.sh` script to deploy a preconfigured Curity Identity Server via Docker.\n- Build and run the mobile app from Xcode using a simulator of your choice.\n- There is a preconfigured user account you can sign-in with: `demouser / Password1`. Feel free to create additional accounts.\n- Run the `./stop-idsvr.sh` script to free Docker resources.\n\nBy default the Curity Identity Server instance runs on localhost.\nIf you prefer to expose the Server on the Internet (e.g. to test with a real device), you can use the\nngrok tool for that. Edit the `USE_NGROK` variable in `start-server.sh` and `stop-server.sh` scripts.\nThis [Mobile Setup](https://curity.io/resources/learn/mobile-setup-ngrok/) tutorial further describes\nthis option.\n\n### Setting up with Your Own Instance of the Curity Identity Server\n\nYou can install and run your own instance of the Curity Identity Server by following this tutorial: https://curity.io/resources/getting-started/\n\nModify *curity-config.xml* by replacing these placeholders:\n\n- $ID$: A unique identifier of the Token Service profile. This identifier would be visible in your identity server. If you haven't changed the default settings of your Curity Identity Service, then this will be `token-service`.\n- $APPID$: Your iOS application ID, for example, `ABCD1234.com.myapplication`. `ABCD1234` can be found in your developer / app store account. `com.myapplication` is the bundle identifier configured in your Xcode project and defined in your app store account for of your application. The demo app bundle identifier is `io.curity.cat.ios.client`.\n\nOnce installed you can easily configure the server by uploading the provided configuration file.\n❗️When applying the provided configuration to your identity server, you will be able to run directly the demo application on the simulator.\n\nTo upload the configuration, follow these steps:\n1. Login to the admin UI (https://localhost:6749/admin if you're using defaults).\n2. Upload `curity-config.xml` through the **Changes**-\u003e**Upload** menu at the top. (Make sure to use the `Merge` option)\n3. Commit changes through the **Changes**-\u003e**Commit** menu.\n\n## Testing the demo app against your identity server\n\n### Simulator\n\n1. Make sure that the Curity Identity Server is running and configured.\n2. Run the demo app on a chosen simulator.\n3. Tap `Start Authentication`.\n\n### Physical device\n\n1. Make sure that the Curity Identity Server is running and configured to be reachable on the Internet (e.g. by using [ngrok](https://curity.io/resources/learn/expose-local-curity-ngrok/)), or\nfrom another device on the same network (e.g. by setting the base URL to `https://192.168.1.3:8443`, if that's the host's IP on the network).\n2. Run the demo app on your device.\n4. Tap *Settings* in the tab navigation bar of the app.\n5. Tap your active profile (**Default** if no other profile has been created and made active).\n6. Change Base URL and the issuer URI to the one configured for your Curity Identity Server. For example, https://192.168.1.3:8443 and https://192.168.1.3:8443/oauth/v2/aouth-anonymous/.\n7. Tap **Fetch the latest configuration** to read metadata from the server.\n7. Tap *Home* in the tab navigation bar of the app.\n8. Tap `Start Authentication`.\n\n### Demo app information\n\n- The demo app will interact with the client \"\u003cu\u003ehaapi-ios-dev-client\u003c/u\u003e\", unless changed (see [Configuring the app](#configuring-the-app))\n- The Demo application is configured in order to support the redirect-uris. See the /Demo/Info.plist in CFBundleURLTypes\n  - CFBundleURLName: io.curity.haapi\n  - CFBundleURLSchemes: \u003cu\u003ehaapi\u003c/u\u003e\n\n## Configuring the App\n\nThe application needs a few configuration options set to be able to call the instance of the Curity Identity Server.\nDefault configuration is set to work with the dockerized version of the Curity Identity Server which\nis run with the `start-idsvr.sh` script. Should you need to make the app work with a different environment\n(e.g. you have your instance of the Curity Identity Server already working online), then you can adjust\nthe configuration in two ways:\n\n1. You can edit the default settings in the `Demo/Settings/Profile` file.\n   The default settings are defined in the `Constants` enum.\n\n2. You can update settings directly in the running app. When on the home screen of the app you can tap\n   the settings icon. There you will be able to create and edit configuration profiles. You can then\n   switch the active profile to quickly test between different environments of the Curity Identity Server.\n\n## Troubleshooting\n\n- `IdsvrHaapiSdk.HaapiError error 8`: Your identity server was not configured and the demo app cannot reach it. The identity server needs to be configured and accessible for the device or simulator.\n- `IdsvrHaapiSdk.HaapiError error 4.`: If you are running on a simulator and you get this error, it means that Disable Attestation Validation in your client settings is disabled and it should be **\u003cu\u003eenabled\u003c/u\u003e**.\n\n## More information\n\nFor further details about this code example, see the [Tutorial Walkthrough](https://curity.io/resources/learn/swift-ios-haapi/) on the Curity website.\\\nPlease visit [curity.io](https://curity.io/) for more information about the Curity Identity Server.\n\n## Licensing\n\nThis software is copyright (C) 2021 Curity AB. It is open source software that is licensed under the [Apache 2](https://github.com/curityio/react-assisted-token-website/blob/master/LICENSE).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcurityio%2Fios-haapi-demo-app","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcurityio%2Fios-haapi-demo-app","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcurityio%2Fios-haapi-demo-app/lists"}