openclaw - ✅(Solved) Fix Android app: setup code pairing broken — reads "token" but gateway emits "bootstrapToken" [1 pull requests, 4 comments, 5 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#48926Fetched 2026-04-08 00:50:58
View on GitHub
Comments
4
Participants
5
Timeline
5
Reactions
0
Author
Timeline (top)
commented ×4cross-referenced ×1

Root Cause

apps/android/app/src/main/java/ai/openclaw/app/ui/GatewayConfigResolver.kt line 107:

// reads wrong key — "token" is never present in modern setup codes
val token = jsonField(obj, "token")

Decoded setup code from openclaw qr --json:

{"url":"ws://192.168.0.170:18789","bootstrapToken":"..."}

Key is bootstrapToken, not token.

Fix Action

Fix

val token = jsonField(obj, "bootstrapToken") ?: jsonField(obj, "token")

The fallback to "token" preserves compatibility with any older setup codes that used the original key.

PR fix notes

PR #48929: fix(android): read bootstrapToken from setup code and support Android 11

Description (problem / solution / changelog)

Fixes #48926.

  • GatewayConfigResolver: read bootstrapToken (falling back to token) from setup code payload — the gateway has emitted bootstrapToken since v2026.3.9 but the app still read token, causing all pairing attempts to fail with token_missing.
  • OpenClawTheme: gate dynamicLightColorScheme/dynamicDarkColorScheme on API 31+; fall back to static schemes on Android 11.
  • build.gradle.kts: lower minSdk from 31 → 30 to allow install on Android 11 devices.

Changed files

  • apps/android/app/build.gradle.kts (modified, +1/-1)
  • apps/android/app/src/main/java/ai/openclaw/app/ui/GatewayConfigResolver.kt (modified, +6/-1)
  • apps/android/app/src/main/java/ai/openclaw/app/ui/OnboardingFlow.kt (modified, +4/-3)
  • apps/android/app/src/main/java/ai/openclaw/app/ui/OpenClawTheme.kt (modified, +9/-1)

Code Example

// reads wrong key — "token" is never present in modern setup codes
val token = jsonField(obj, "token")

---

{"url":"ws://192.168.0.170:18789","bootstrapToken":"..."}

---

val token = jsonField(obj, "bootstrapToken") ?: jsonField(obj, "token")
RAW_BUFFERClick to expand / collapse

Bug

Android app fails to pair via setup code. The gateway (v2026.3.9+) emits bootstrapToken in the setup code JSON payload, but GatewayConfigResolver.kt reads "token", so it always gets null and connects without a token → reason=token_missing on every attempt.

Root cause

apps/android/app/src/main/java/ai/openclaw/app/ui/GatewayConfigResolver.kt line 107:

// reads wrong key — "token" is never present in modern setup codes
val token = jsonField(obj, "token")

Decoded setup code from openclaw qr --json:

{"url":"ws://192.168.0.170:18789","bootstrapToken":"..."}

Key is bootstrapToken, not token.

Fix

val token = jsonField(obj, "bootstrapToken") ?: jsonField(obj, "token")

The fallback to "token" preserves compatibility with any older setup codes that used the original key.

Symptoms

  • Android app connects to gateway repeatedly with authProvided: none / reason=token_missing
  • No pending device appears in openclaw devices list
  • Clearing app data and re-entering the setup code doesn't help — the token is silently dropped every time

Tested

Fix applied locally, APK rebuilt, pairing now works.

extent analysis

Fix Plan

To resolve the issue, update the GatewayConfigResolver.kt file as follows:

  • Open GatewayConfigResolver.kt and navigate to line 107.
  • Replace the existing line with the corrected code:
val token = jsonField(obj, "bootstrapToken") ?: jsonField(obj, "token")

This change ensures that the code reads the correct key (bootstrapToken) from the setup code JSON payload while maintaining compatibility with older setup codes that use the token key.

Verification

To verify that the fix worked:

  • Rebuild the Android app APK with the updated GatewayConfigResolver.kt file.
  • Clear the app data on the device.
  • Re-enter the setup code and attempt to pair the device with the gateway.
  • Check the gateway logs for successful pairing and the presence of a pending device in openclaw devices list.

Extra Tips

  • Ensure that the openclaw command-line tool is updated to the latest version to avoid any potential compatibility issues.
  • When testing the fix, use the --json flag with the openclaw qr command to verify that the setup code JSON payload contains the expected bootstrapToken key.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING