An example Android app that uses the Curity Identity Server's Hypermedia API to perform an OIDC flow.
Authentication uses native screens without the need for an external browser.
Start with a local automated deployment to ensure that you understand the technical setup.
You can then apply the same configuration to deployed environments.
Ensure that the local computer has these prerequisites:
- A Docker engine.
- The
envsubst
tool, e.g withbrew install gettext
. - The
jq
tool, e.g withbrew install jq
.
First copy a license.json
file for the Curity Identity Server into the root folder.
Then run a Docker deployment and indicate how connected simulators or devices call the Curity Identity Server.
For example, run the following commands to connect to a macOS computer using its IP address.
Or some older Android emulators might require IDSVR_HOST_NAME
to use the special value 10.0.2.2
.
export USE_NGROK='false'
export IDSVR_HOST_NAME="$(ipconfig getifaddr en0)"
./start-idsvr.sh
The Mobile Deployments repository explains further information about the deployed backend infrastructure.
You can view the HAAPI Configuration to understand the settings to apply to deployed environments.
Run the app and first test basic logins using an HTML Form authenticator.
Sign in to the deployed environment and use a pre-shipped test user account.
- Username:
demouser
- Password:
Password1
Passkeys require hosting of assets documents at a trusted internet HTTPS URL.
You can use ngrok to host assets documents to enable the testing of passkeys logins.
The following example commands deploy the Curity Identity Server with a passkeys configuration.
See the tutorial link at the end of this README to learn more about the ngrok tool.
export USE_NGROK='true'
./start-idsvr.sh
Once you have finished local testing, free all backend resources with the following command:
./stop-idsvr.sh
The following links point you to the most essential areas of the example app's source code.
This app only authenticates the user, then displays the tokens obtained from the authorization server.
See the following source files to understand how that works:
- The Configuration object contains all of the OpenID Connect settings.
- The DemoApplication shows how to create a global object to complete the configuration.
- The MainActivity shows how to use a
haapiFlowLauncher
to implement a login and receive tokens. - The AuthenticatedActivity and TokensFragment show how to use tokens to call APIs once authentication completes.
The HAAPI Android customization tutorial explains how to change the default theme.
See also the Developer Documentation for the finer details of customization options.
See the following tutorials for additional developer information:
- The Kotlin Android App using HAAPI tutorial provides an overview of the code example's behaviors.
- The ngrok tutorials explain how to use an internet URL and view HAAPI messages.
- The Configure Native Passkeys for Mobile Logins tutorial explains the technical setup when using passkeys.
- The HAAPI Mobile Guides provide further details for HAAPI mobile developers.
- The Implementing HAAPI Attestation Fallback explains how to manage non-compliant Android devices.
Please visit curity.io for more information about the Curity Identity Server.