Files
Arkie-Library-Frontend/.unipi/docs/fix/2026-06-04-imtoken-auto-login-without-query-fix.md
2026-06-04 09:46:24 +08:00

1.4 KiB

title, type, date
title type date
imToken in-app browser opens but does not log in — Quick Fix quick-fix 2026-06-04

imToken in-app browser opens but does not log in — Quick Fix

Bug

imToken can be opened from Chrome into its in-app browser, but the site does not complete wallet login.

Root Cause

AutoInjectedLogin only started when the URL contained ?autoLogin=imToken. imToken's deeplink/in-app-browser navigation can open the page while dropping or not preserving that query string, so the auto-login effect never ran even though the page was inside imToken and an injected provider was available.

Fix

Added an imToken browser fallback: if no explicit autoLogin query parameter exists, but the current user agent is imToken, AutoInjectedLogin treats it as an imToken direct-login session and runs the same injected login path.

Files Modified

  • src/wallet/AutoInjectedLogin.tsx — starts imToken direct login based on imToken in-app-browser detection when the deeplink query is missing.
  • src/wallet/injected.ts — exports isImTokenBrowser() so the auto-login flow can reuse the imToken browser detection.

Verification

  • npx tsc --noEmit
  • npm run format:check
  • npm test

Notes

This preserves the explicit ?autoLogin= flow for TokenPocket and other wallets, while making imToken robust when the deeplink opens the page without the query parameter.