Reference Flutter app for Sign in with KRDPASS.
- Flutter 3.44 or newer
- KRDPASS app on test device/emulator
- A publicly reachable HTTPS URL for the callback
- A running backend that performs PAR + token exchange (see the integration guide linked below)
- Install dependencies:
flutter pub getThis sample targets Flutter SDK v1.6.0 and Android core 1.6.0, both
resolved from the published release.
- Create local
.envfrom template (required:pubspec.yamlbundles.envas an asset, so the build fails without it):
cp env.example .envEdit .env values:
CLIENT_ID=your-client-id
REDIRECT_URI=https://your-backend.example.com/_krdpass/oauth/callback
BACKEND_URL=https://your-backend.example.com
KRD_ENVIRONMENT=developmentThe app rejects the your-...example.com placeholders at startup, and
KRD_ENVIRONMENT must be development or production if set.
-
For the server-mediated flow, stand up a backend that implements PAR + token exchange (see
../serverand the integration guide in Related Docs). PointBACKEND_URLat it.Set
DEMO_UNAUTHENTICATED_TOKEN_ROUTES=truein the server's.envif you want the Refresh and Revoke buttons and the revoke half of Sign Out to work. Those routes are off by default and return 404, deliberately: they attach the server'sCLIENT_SECRETto whatever token a caller posts. See../server/README.md. -
Android signing (required for sign-in to succeed):
cp android/key.properties.example android/key.properties # then point it at the registered keystoreKRDPASS validates the calling app's signing certificate, so this app must be signed
with a keystore whose SHA-256 fingerprint is registered against the client. If
android/key.properties is missing the build uses the default debug keystore, which is
not registered, so sign-in then fails with invalid_client.
-
iOS: set the Associated Domains host in
ios/Runner/Runner.entitlements(applinks:<your-app-universal-link-host>) to match yourREDIRECT_URIhost. -
Run the Flutter sample:
flutter run.envis declared as a Flutter asset inpubspec.yaml, which means it is copied verbatim into the APK and the IPA and can be extracted from either. Everything in it is public by construction: a client id, a redirect URI, a backend URL. Nothing that has to stay secret can live there.- Use your app's Universal Link host for
REDIRECT_URI(iOS Associated Domains).
- Flutter SDK README: krdpass-auth-sdk-flutter
- Integration guide: https://docs.digital.gov.krd/software-development/04-interoperability/11-krdpass-overview.html
- Toolchain pins:
../docs/BUILDING.md