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.

1

2 Answers 2

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!

Sign up to request clarification or add additional context in comments.

Comments

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.