Skip to content
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

[Bug] Cannot use Custom Tabs with Android 29+ #2418

Closed
1 of 7 tasks
trwalke opened this issue Feb 17, 2021 · 8 comments
Closed
1 of 7 tasks

[Bug] Cannot use Custom Tabs with Android 29+ #2418

trwalke opened this issue Feb 17, 2021 · 8 comments

Comments

@trwalke
Copy link
Member

trwalke commented Feb 17, 2021

Logs and Network traces
Without logs or traces, it is unlikely that the team can investigate your issue. Capturing logs and network traces is described at https://github.com/AzureAD/microsoft-authentication-library-for-dotnet/wiki/logging

Which Version of MSAL are you using ?
MSAL 4.24.0 +

Platform
xamarin android

What authentication flow has the issue?

  • Desktop / Mobile
    • Interactive
    • Integrated Windows Auth
    • Username Password
    • Device code flow (browserless)
  • Web App
    • Authorization code
    • OBO
  • Daemon App
    • Service to Service calls

Repro
Ensure the app is targeting android 10 (API 29) in the project properties.
Ensure that the system browser is enabled in MSAL.NET (Should be on by default)
Try to acquire a token interactively

Expected behavior
MSAL should launch the custom tab browser for authentication

Actual behavior
The system browser is launched without custom tabs.

Possible Solution
Try modifying the browser tab packages that are used in the interactive auth.

// this is used to check if anything can open custom tabs.
// Must use the classic support. Leaving the reference AndroidX intent
#if __ANDROID_29__
private readonly string _customTabsServiceAction =
"androidx.browser.customtabs.action.CustomTabsService";
#else
private readonly string _customTabsServiceAction =
"android.support.customtabs.action.CustomTabsService";
#endif

@jmprieur
Copy link
Contributor

@trwalke. is it a duplicate of #2139 ?

@trwalke trwalke modified the milestones: 4.27.0, 4.28.0 Feb 19, 2021
@bgavrilMS
Copy link
Member

Closing as duplicate of #2139

@trwalke trwalke changed the title [Bug] System browser is not functional on Android 11 [Bug] Cannot use Custom Tabs with Android 29+ Feb 26, 2021
@trwalke trwalke reopened this Feb 26, 2021
@trwalke
Copy link
Member Author

trwalke commented Feb 26, 2021

Not a duplicate. this is the second issue identified in #2139

@trwalke
Copy link
Member Author

trwalke commented Mar 26, 2021

@tipa it appears that there is a new way to implement the custom tabs in android 29. Ive been playing around with it to see if there is a way to adapt our code with it to make it work. I managed to get the custom tab to show up but the responses do not return to our code at the moment. I was also able to get the legacy support for custom tabs to work so I think it will be ok for us to use that for now.

@tipa
Copy link

tipa commented Mar 26, 2021

Not sure what you mean with legacy support buty ou can test the file attached if you need it. I am using it successfully to authenticate to many services, like Dropbox, Google Drive etc.
AuthorizationManagementActivity.zip

You can start the auth flow with AuthorizationManagementActivity.AuthenticateAsync(url); and the WebAuthenticationCallbackActivity will be called if the scheme is set correctly.

@trwalke
Copy link
Member Author

trwalke commented Mar 26, 2021

@tipa I was referring to using
"android.support.customtabs.action.CustomTabsService"

as opposed to
"androidx.browser.customtabs.action.CustomTabsService".

which would require us to use the custom tab intent here
https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsIntent

this appears to be the way to implement customtabs in android 29+

Perhaps legacy is the wrong word.

I am able to get the custom tabs working again with "android.support.customtabs.action.CustomTabsService" however so we can release a fix with that

@trwalke trwalke added the In PR label Mar 26, 2021
@trwalke trwalke removed the In PR label Mar 26, 2021
@trwalke trwalke added the Fixed label Mar 26, 2021
@tipa
Copy link

tipa commented Mar 30, 2021

Yay, looks fixed with 4.29.0 - thanks!

@bgavrilMS
Copy link
Member

Thank you for patience @tipa !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants