[Android] Pass the launched extra when resuming WebAuthenticator#30583
Merged
[Android] Pass the launched extra when resuming WebAuthenticator#30583
Conversation
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
Contributor
There was a problem hiding this comment.
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 (
LaunchedExtraandActualIntentExtra) tointernaland PascalCase. - Updated usages of those constants throughout the intermediate activity.
- Added a
PutExtrafor theLaunchedExtraflag 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. |
src/Essentials/src/WebAuthenticator/WebAuthenticatorCallbackActivity.android.cs
Show resolved
Hide resolved
PureWeen
approved these changes
Jul 25, 2025
src/Essentials/src/WebAuthenticator/WebAuthenticatorCallbackActivity.android.cs
Show resolved
Hide resolved
src/Essentials/src/WebAuthenticator/WebAuthenticatorIntermediateActivity.android.cs
Show resolved
Hide resolved
This was referenced Aug 15, 2025
Closed
Bump Microsoft.AspNetCore.Components.WebView.Maui from 9.0.90 to 9.0.100
ILoveDotNet/ilovedotnet#467
Merged
This was referenced Aug 19, 2025
5 tasks
10 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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