Skip to content

Sign in with KRDPASS (App-to-App): Testing & Go-Live

Quick Test with Scripts

The fastest way to validate end-to-end: App → Backend → KRDPASS → callback → tokens.

1. Create local secrets

bash
cp shared/secrets/.env.example shared/secrets/.env

Fill in shared/secrets/.env:

  • BACKEND_URL, REDIRECT_URI, CLIENT_ID, CLIENT_SECRET, RSA_PRIVATE_KEY

2. Sync configs to all sample apps

bash
./scripts/sync-secrets.sh

This updates examples/server/.env, all sample app .env files, and Android signing configs.

Platform-specific sync

bash
./scripts/sync-secrets-android.sh   # Android only
./scripts/sync-secrets-ios.sh       # iOS only

3. Start backend

bash
./scripts/run-sample.sh --app server

Keep this terminal running.

The demo server runs on localhost:3000, but iOS Universal Links require AASA to be served from a real HTTPS domain. Use Cloudflare Tunnel to expose your local server through a domain you control.

Quick tunnel (temporary domain, no setup):

bash
cloudflared tunnel --url http://localhost:3000

This gives you a temporary URL like https://random-name.trycloudflare.com. Works for all platforms, but the domain changes every time you restart the tunnel — meaning you'd need to update Associated Domains in Xcode and rebuild for iOS each time.

Named tunnel (your own domain, recommended for iOS):

bash
# One-time setup
cloudflared tunnel create krdpass-dev
cloudflared tunnel route dns krdpass-dev auth.yourdomain.com

# Run the tunnel
cloudflared tunnel run --url http://localhost:3000 krdpass-dev

Once running, https://auth.yourdomain.com points to your local server. Use this domain as:

  • BACKEND_URL in your .envhttps://auth.yourdomain.com
  • REDIRECT_URIhttps://auth.yourdomain.com/_krdpass/oauth/callback
  • iOS Associated Domainsapplinks:auth.yourdomain.com
  • AASA will be served at → https://auth.yourdomain.com/.well-known/apple-app-site-association

TIP

After changing the domain, re-run ./scripts/sync-secrets.sh so all sample apps pick up the new values.

4. Run a sample app

bash
# Flutter
./scripts/run-sample.sh --app flutter --platform android
./scripts/run-sample.sh --app flutter --platform ios

# Native
./scripts/run-sample.sh --app android
./scripts/run-sample.sh --app ios

# React Native
./scripts/run-sample.sh --app react-native --platform android
./scripts/run-sample.sh --app react-native --platform ios
Script options
bash
# Sync before launching
./scripts/run-sample.sh --app flutter --platform android --sync

# Force patch tracked demo files
./scripts/run-sample.sh --app ios --sync-patch-tracked

# Custom secrets file
./scripts/sync-secrets.sh --secrets-file /path/to/.env

# Specific device
./scripts/run-sample.sh --app ios --device "iPhone 13 Pro"
  1. Flutter Android → 2. Flutter iOS → 3. Android native → 4. iOS native → 5. React Native Android → 6. React Native iOS

What to test

Troubleshooting

Error codes

ErrorMeaningFix
cancelledUser cancelled authHandle gracefully, allow retry
busyAuth already in progressPrevent duplicate taps
timeoutFlow timed outRetry, verify app switch behavior
launch_failedCan't open KRDPASS appCheck app availability
invalid_redirectCallback redirect mismatchCheck exact registered redirect URL
state_mismatchState doesn't matchDon't reuse state values, generate fresh each time
no_codeCallback came back without codeCheck callback params and server logs
platform_errorGeneric platform failureValidate setup and initialization

iOS callback never returns

Android returns invalid_redirect

Token exchange fails with state error

state_mismatch appears intermittently

    • Flutter: KrdpassAuth.instance.generateState()
    • Android: KrdpassAuth.generateState()
    • iOS: try auth.generateState()
    • React Native: KrdpassAuth.generateState()

React Native module unavailable

No refresh token in response

  • Confirm you requested offline_access scope
  • Confirm refresh token issuance is approved for your integration (restricted by default)

Quick sanity reset

Before deep debugging, reset everything:

bash
./scripts/sync-secrets.sh
./scripts/run-sample.sh --app server

Then re-run your app.

General debug checklist

Still stuck?

Email integration@pass.krd with: SDK + platform + version, environment, error code, request timestamp, and reproduction steps.

Go-Live Security Checklist

Before you ship

OAuth requirements

Production hardening

Refresh token policy

  • Default: avoid refresh tokens unless required
  • If enabled: strict storage, rotation, and revocation
  • Use backend controls, not client-side persistence

Next Step

Reference — Endpoint contracts, environment variables, and platform setup details