Essentials icon indicating copy to clipboard operation
Essentials copied to clipboard

[Bug] WebAuthenticator -> You must subclass the `WebAuthenticatorCallbackActivity` and create an IntentFilter for it which matches your `callbackUrl`.

Open denz96 opened this issue 5 years ago • 2 comments

Bug report best practices: Submitting Issues

Description

Steps to Reproduce

  1. use "xamarinessentials://ABC" in the WebAuthenticationCallbackActivity subclass
  2. use "xamarinessentials://ABC" in the webauthenticator.authenticationasync callback uri

Expected Behavior

app should open website for login

Actual Behavior

error encountered You must subclass the WebAuthenticatorCallbackActivity and create an IntentFilter for it which matches your callbackUrl.

Basic Information

  • Version with issue:

  • Last known good version: unknown

  • IDE: Visual studio for mac

  • Platform Target Frameworks: android

    • iOS:
    • Android: API 29
    • UWP:
  • Android Support Library Version:

  • Nuget Packages: xamarin essentials

  • Affected Devices:

Screenshots

Screen Shot 2021-04-17 at 9 47 12 AM Screen Shot 2021-04-17 at 9 47 35 AM Screen Shot 2021-04-17 at 9 48 00 AM

Reproduction Link

denz96 avatar Apr 17 '21 01:04 denz96

This is an example for the data scheme directly from the sample which work sout of the box.

    [Activity(NoHistory = true, LaunchMode = LaunchMode.SingleTop)]
    [IntentFilter(new[] { Intent.ActionView }, Categories = new[] { Intent.CategoryDefault, Intent.CategoryBrowsable }, DataScheme = "xamarinessentials")]
    public class WebAuthenticationCallbackActivity : Xamarin.Essentials.WebAuthenticatorCallbackActivity
    {
    }

and then: https://github.com/xamarin/Essentials/blob/main/Samples/Samples/ViewModel/WebAuthenticatorViewModel.cs#L58-L61

try it without your ABC

jamesmontemagno avatar Apr 21 '21 23:04 jamesmontemagno

hi @jamesmontemagno,

In the Webauthenticator.Authenticateasync method, the 2nd parameter is a callbackuri, the callbackuri to be inputted there is the one we registered in the backend side? or it will not matter since we already added the registered callbackuri in the authorizeurl passed in the 1st paramete?

denz96 avatar Apr 23 '21 23:04 denz96