0
我正在开发Xamarin跨平台应用程序,我正在实施Google Sign。 从浏览器和邮递员中,我可以使用api验证和获取用户数据。 但是,当我在Xamarin中使用webview形式时,出现了disallowed_useragent错误。当使用Google api时,xamarin form disallowed_useragent with webview
因为Google不再支持webview请求。因此,我需要在andriod中设置用户代理以及iOS应用程序,或者在PCL项目中设置将由两个平台使用的内容。
我没有找到解决方案来解决这个问题
这里是我的代码:
private async void LoginWithGoogle_Clicked(object sender, EventArgs e)
{
ShowLoader(true);
var authRequest =
"https://accounts.google.com/o/oauth2/v2/auth"
+ "?response_type=code"
+ "&scope=email%20profile"
+ "&redirect_uri=" + Constants.GoogleRedirectUri
+ "&client_id=" + Constants.GoogleClientId;
var webView = new WebView
{
Source = authRequest,
HeightRequest = 1
};
webView.Navigated += WebViewOnNavigatedForGoogle;
Content = webView;
ShowLoader(false);
}