Skip to content

[Android] Pass the launched extra when resuming WebAuthenticator #30583

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mattleibow
Copy link
Member

@mattleibow mattleibow commented Jul 11, 2025

Note

Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!

Description of Change

Sometimes the intermediate activity is finished prematurely and state is lost. By passing the flag directly when resuming we never even need to keep the intermediate activity around.

I am not sure why the activity is finished in some cases, but it may be memory pressure or the OS decides it can. Either way, the only extras we care about is the launched flag. This is set to true to indicate that it has already launched, and then we can just resume the auth and finish.

If you get here and it is NOT launched and the activity is cleaned up, then something else has gone wrong as this activity is only start directly from maui auth with extras, or resumed from app code. It is not an exported activity and cannot be launched from outside the app.

Issues Fixed

Fixes #24692

Sometimes the intermediate activity is finished
prematurely and state is lost. By passing the flag
directly when resuming we never even need to keep
the intermediate activity around.

Fixes #24692
@Copilot Copilot AI review requested due to automatic review settings July 11, 2025 16:48
@mattleibow mattleibow requested a review from a team as a code owner July 11, 2025 16:48
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates the web authentication flow on Android to propagate the launched flag when resuming from the callback activity, ensuring the intermediate activity knows it should handle a callback rather than start a new auth session.

  • Renamed and exposed extras constants (LaunchedExtra and ActualIntentExtra) to internal and PascalCase.
  • Updated usages of those constants throughout the intermediate activity.
  • Added a PutExtra for the LaunchedExtra flag in the callback activity.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/Essentials/src/WebAuthenticator/WebAuthenticatorIntermediateActivity.android.cs Renamed extras constants to LaunchedExtra/ActualIntentExtra and updated references.
src/Essentials/src/WebAuthenticator/WebAuthenticatorCallbackActivity.android.cs Added PutExtra for LaunchedExtra when restarting the intermediate activity.

@mattleibow mattleibow changed the title Pass the launched extra wen resuming auth Pass the launched extra when resuming auth Jul 11, 2025
@mattleibow mattleibow changed the title Pass the launched extra when resuming auth [Android] Pass the launched extra when resuming WebAuthenticator Jul 11, 2025
@mattleibow mattleibow added the p/0 Work that we can't release without label Jul 11, 2025
@mattleibow mattleibow modified the milestones: .NET 9 SR9, .NET 9 SR10 Jul 11, 2025
@mattleibow mattleibow moved this from Todo to Ready To Review in MAUI SDK Ongoing Jul 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p/0 Work that we can't release without
Projects
Status: Ready To Review
Development

Successfully merging this pull request may close these issues.

WebAuthenticator crashes on first start of browser
1 participant