Reference Expo app for Sign in with KRDPASS. The SDK package supports both Expo and bare React Native apps.
- Node.js 22.11+ (CI builds on 24)
- Expo CLI tooling
- iOS/Android native toolchains for
expo run:* - A running backend that implements the server-mediated PAR + token exchange (see Sign in with KRDPASS)
This sample intentionally commits and maintains its Android native project;
the iOS project is generated locally by Expo prebuild. Expo Doctor's app-config
synchronization check is therefore disabled in package.json; other Doctor
checks remain enabled.
See docs/BUILDING.md for toolchain pins.
- Install dependencies:
npm installThis sample targets React Native SDK v1.6.0 and Android core 1.6.0,
both installed from the published release.
No package-lock.json is tracked between releases: the lockfile is
regenerated and committed at release time, so use npm install until then.
- Configure demo values from template:
cp .env.example .envSet values in .env:
EXPO_PUBLIC_BACKEND_URL=https://your-backend.example.com
EXPO_PUBLIC_REDIRECT_URI=https://your-backend.example.com/_krdpass/oauth/callback
EXPO_PUBLIC_CLIENT_ID=your-client-id
EXPO_PUBLIC_KRD_ENVIRONMENT=developmentThese values are read by config.ts. It rejects the placeholder values above, so
the app fails at startup with a config message rather than at a DNS lookup later.
EXPO_PUBLIC_KRD_ENVIRONMENT must be development or production; anything else
throws.
-
For the server-mediated flow, run the reference backend: see
../server.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): copy
android/key.properties.exampletoandroid/key.propertiesand point it at your registered keystore (storeFile,storePassword,keyAlias,keyPassword).KRDPASS 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
key.propertiesis missing the build uses the default debug keystore, which is not registered, so sign-in then fails withinvalid_client. -
Configure iOS Universal Link host in
app.json:
expo.ios.associatedDomainsshould includeapplinks:<your-app-universal-link-host>.
- Run app:
npx expo run:android
# or
npx expo run:iosFor iOS physical devices, start Metro for dev-client in a separate terminal:
npx expo start --dev-client --tunnel- Set
EXPO_PUBLIC_REDIRECT_URIto your app's Universal Link host (not a generic backend placeholder). - Android callback returns through Intent result while OAuth policy still requires
redirectUri. npm testruns the shared redirect-validation vectors fromshared/test-vectorson thenode:testrunner. It needs no test framework because it exercises no React Native surface.
- React Native SDK README: https://github.com/ditkrg/krdpass-auth-sdk-react-native#readme
- Bare React Native sample:
../react-native-bare - Sign in with KRDPASS (backend integration reference): https://docs.digital.gov.krd/software-development/04-interoperability/11-krdpass-overview.html
- Toolchain pins:
../docs/BUILDING.md