Skip to content

Fix Chrome Custom Tab auto-dismissal after verification on Android#14

Merged
seftena merged 2 commits into
masterfrom
fix/custom-tab-dismissal
Apr 23, 2026
Merged

Fix Chrome Custom Tab auto-dismissal after verification on Android#14
seftena merged 2 commits into
masterfrom
fix/custom-tab-dismissal

Conversation

@seftena
Copy link
Copy Markdown
Contributor

@seftena seftena commented Apr 23, 2026

What

After verification completes, the Chrome Custom Tab was not dismissing automatically —
the user had to manually tap Done/Dismiss. iOS handles this natively via
ASWebAuthenticationSession. Android requires the SDK to manage it explicitly.

Root Cause

IDmeRedirectActivity was calling finish() after receiving the redirect, which popped
it off the stack but revealed the Custom Tab sitting behind it. Nothing was bringing
the calling app back to the foreground.

Fix

  • Store a WeakReference to the calling Activity in IDmeAuthManager when the auth
    flow starts, cleared on completion
  • In IDmeRedirectActivity, after the redirect is received, fire an explicit intent
    back to the calling Activity with FLAG_ACTIVITY_CLEAR_TOP before calling finish(),
    which removes the Custom Tab from the back stack and returns the user to the app

Files changed

  • IDmeAuthManager.kt — added WeakReference to calling Activity
  • IDmeRedirectActivity.kt — added foreground restore on redirect

seftena added 2 commits April 23, 2026 11:48
Force custom window close
Dismiss Chrome Custom Tab automatically after verification completes
@seftena seftena requested review from a team as code owners April 23, 2026 15:53
@seftena seftena merged commit 1a1c436 into master Apr 23, 2026
1 check passed
@seftena seftena deleted the fix/custom-tab-dismissal branch April 23, 2026 17:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants