我最近遇到此错误错误消息
我认为这是由于Google Oauth的这一变化:https://developers.googleblog.com/2016/08/modernizing-oauth-interactions-in-native-apps.html.
我正在使用Azure身份验证服务来验证我用Xamarin Forms(C#)编写的iOS应用程序.
代码请求Azure身份验证服务:
var window = UIKit.UIApplication.SharedApplication.KeyWindow;
var root = window.RootViewController;
if(root != null)
{
var current = root;
while(current.PresentedViewController != null)
{
current = current.PresentedViewController;
}
var user = await AzureService.Instance.Client.LoginAsync(window.RootViewController, MobileServiceAuthenticationProvider.Google, new Dictionary<string, string>() { { "access_type", "offline" } });
return user;
}
Run Code Online (Sandbox Code Playgroud)
URL请求是:
using(var client = new HttpClient())
{
const string url = "https://www.googleapis.com/oauth2/v3/userinfo?alt=json&suppress_webview_warning=true";
client.DefaultRequestHeaders.Add("Authorization", token);
var json = client.GetStringAsync(url).Result;
var profile = JsonConvert.DeserializeObject<GoogleUserProfile>(json);
return profile;
}
Run Code Online (Sandbox Code Playgroud)
但是它仍然显示错误:Google的Azure身份验证设置正确,因为我一直使用此设置超过一个月,直到最近.任何人都有同样的问题或任何想法如何解决这个问题?
authentication azure-mobile-services google-oauth xamarin.forms