Skip to content
This repository has been archived by the owner on May 15, 2024. It is now read-only.

Web Authenticator not returning back to App in Android 12, when user sharing(Intent.ActionSend) #2081

Closed
DharunAR opened this issue Mar 27, 2023 · 2 comments · Fixed by #2090
Labels
bug Something isn't working

Comments

@DharunAR
Copy link

DharunAR commented Mar 27, 2023

Description:

We developed a mobile app, where users can share documents and pictures from Mobile App.

When user shares a picture/document with our Mobile App, the app will ask the user to log in. We are using WebAuthenticator to login and logout from our app.

Once the login has been made, from the browser it is not redirected back to the APP. We found it is happening only on Android devices, and when we are sharing, the Intent action will be Intent.ActionSend

Steps to Reproduce

  1. Create a sample content page with a button(let's call it as login button).

  2. In MainActivity.cs -> Add a code to support sharing -> [[IntentFilter(new[] { Intent.ActionSend }, Categories = new[] { Intent.CategoryDefault }, DataMimeTypes = new[]
    {
    "image/",
    "image/bmp",
    "image/jpg",
    "image/png",
    "text/plain",
    "application/vnd.oasis.opendocument.text",
    "application/vnd.oasis.opendocument.image",
    "application/vnd.ms-excel",
    "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
    "application/vnd.openxmlformats-officedocument.spreadsheetml.template",
    "application/msword",
    "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
    "application/vnd.openxmlformats-officedocument.wordprocessingml.template",
    "application/pdf",
    "application/vnd.ms-powerpoint",
    "application/vnd.openxmlformats-officedocument.presentationml.presentation",
    "application/vnd.openxmlformats-officedocument.presentationml.template",
    "video/
    ",
    "video/mp4"

     })]]
    
  3. On login button click, add a code for the web authenticator something like the below:
    [ await WebAuthenticator.AuthenticateAsync(new WebAuthenticatorOptions
    {
    Url = new Uri($"{_baseUrl}/auth/mobile"),
    CallbackUrl = new Uri("trimapp://")
    });]

  4. Open your gallery, share any image -> Select the app you have developed. It will show an login button

  5. Click on the login button -> Web authenticator will take you to the chrome browser to login to the app.

  6. After the successful login, it is not getting redirected to the APP.

Expected Behavior

App should be redirected without any issues.

Actual Behavior

App stays in browser page, but in background i can see the Application instance got opened, but the redirection was not happening.

Basic Information

  • Version with issue:
  • Last known good version: Android 11
  • IDE:
  • Platform Target Frameworks:
    • iOS:
    • Android:
    • UWP:
  • Android Support Library Version:
  • Nuget Packages: 1.7.0(Xamarin.Essentials)
  • Affected Devices: Android 12
@DharunAR DharunAR added the bug Something isn't working label Mar 27, 2023
@ekeneduru
Copy link

Any solution for this

@jfversluis
Copy link
Member

This might be fixed by #2090 would you be able to try the resulting NuGet package from that PR?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants