0

I am developing Xamarin Forms PCL app in which I am trying to integrate Google Authentication with Xamarin.Auth component. But unfortunately I am getting disallowed_useragent error while trying to authenticate with Google. Everything is working fine with Facebook and other Social Media authentication.

Any help would great for me to go ahead.

  • Possible duplicate of [403 Error - Thats an error. Error: disallowed\_useragent](http://stackoverflow.com/questions/40591090/403-error-thats-an-error-error-disallowed-useragent) – Gerald Versluis Apr 20 '17 at 11:31

2 Answers2

0

The problem happens because google has recently changed it policy to not allow WebViews (and other embedded browsers) to be a part of the authorization process. One should instead use the new, native browsers: CustomTabs on Android and a Safari thing (Sorry, i forgot the name) on iOS.

To solve the issue:
1. Update Xamarin.Auth to the newest version
2. Install the Xamarin.Support.CustomTabs NuGet package (I think it installs itself with the newest Auth version)
3. In the Authenticator constructor add a true value for the IsUsingNativeUI property
4. Call the GetUI() function and cast it's value to CustomTabsIntent.Builder
5. Call builder.Build().LaunchUrl() with the Authenticator.GetInitialUrlAsync() function


Hope it helps!

Tored
  • 55
  • 9
0

disallowed_useragent means (most likely) app is using embedded WebViews which are forbidden since 2017-04-20.

Xamarin.Auth supports CustomTabs and SafariView controller since 2017-03-2x nuget version v.1.4.x. Version 1.5.0 has Forms support integrated.

moljac
  • 946
  • 9
  • 12