Demo app
The Signicat OIDC SDK for Android includes a demo app that demonstrates a complete integration.
You can use it as a reference implementation and to confirm that your environment works before you integrate the SDK into your own app.
The demo app comes with placeholder values. Before you run it, you must configure it with your own OIDC client.
What does it look like?
The demo app covers every part of an integration. You can use the image slider below to see what the flow looks like from the mobile app:
When the demo app starts, it shows a splash screen while restoring a stored session.
It shows loading indicators and handles errors throughout the process. It shows the technical error details, which you can copy to debug your integration.
It also contains a complete example of a DigiD app-to-app flow.
To learn more, see the Demo app example section on the Android App-to-app flow page.
Get the demo app
The demo app is available as a source ZIP file from our repository, alongside the SDK. Because the repository is private, you need login credentials to access it.
To get login credentials for our Nexus repository, you can request them by creating a support ticket in the Signicat Dashboard.
To access the file:
- Navigate to the demo app in our Nexus repository, then enter your Nexus repository login credentials.
- Browse for the version you want, then download the ZIP file.
Build the demo app from source
To build the demo app from the source ZIP file:
- Extract the ZIP file, then open the project in Android Studio and allow Gradle to sync.
- Configure the demo app with your OIDC client.
- Select the app run configuration, then run it on an Android device.
How it works
The demo app uses Kotlin, Jetpack Compose and MVM architecture. For an overview of the most important source code files, see the table below:
The file DemoViewModel is most useful to read first. It shows how the following SDK operations map to the app state, with the error cases each one has to handle:
- Restoring a session when the app starts.
- Logging in.
- Fetching user info.
- Logging out.
The file DemoAppOidcConfig.kt contains the OIDCConfiguration available on the login screen (Standard OIDC Login) and provides flags that control how the app behaves.
/** Standard OIDC configuration offered on the demo app's login screen. */
val DemoAppOidcConfig = OIDCConfiguration(
issuer = BuildConfig.OIDC_ISSUER.toUri(),
clientId = BuildConfig.OIDC_CLIENT_ID,
redirectUri = BuildConfig.OIDC_REDIRECT_URI.toUri(),
scopes = setOf("openid", "offline_access", "idp-id", "mobileid", "mobileid-extra"),
promptLogin = true,
persistSession = ShouldRestoreSession,
)
/** Whether to persist the OIDC session and restore it on app launch. */
const val ShouldRestoreSession = true
/**
* Whether to enable strict mode for debug variant, to help look for violations that could
* potentially generate ANRs or other problems.
*/
const val StrictModeEnabled = true
The demo app sets persistSession from ShouldRestoreSession.
By default, it shows a splash screen while restoring a stored session. To keep the session in memory only and always start on the login screen, set ShouldRestoreSession to false.
Configure with your OIDC client
The demo app comes with placeholder values (example.com and your-client-id). Before you run it, configure it with your own OIDC client:
- In
build.gradle.kts, set the issuer, client ID and redirect URI of your OIDC client:OIDC_ISSUER,OIDC_CLIENT_IDandoidcRedirectUri.NoteThe redirect URI also sets the following manifest placeholders:
signicatOidcRedirectUriHostsignicatOidcRedirectUriPath
- In
DemoAppOidcConfig.kt, setscopesto the scopes of your OIDC client. - In
build.gradle.kts, set up the signing configuration to use your own keystore and credentials. - Publish a Digital Asset Links file on your domain that lists the demo app's application ID and the SHA-256 fingerprint of the certificate you sign it with.
To also try the DigiD app-to-app example, set DIGID_APP2APP_ACS_URI in build.gradle.kts as well.
For details, see the Android implementation of the DigiD app-to-app flow.
App-to-app example (DigiD app2app)
Some identity providers authenticate the end-user in their own mobile app rather than on a web page. This is known as an app-to-app flow.
The demo app includes examples of these flows so that you can test them and see how they work.
To learn more, see the Android App-to-app flow page.