我相當最近Error MessageAzure的谷歌認證顯示錯誤:disallowed_useragent
我認爲這是遇到了這個錯誤,由於這一變化在谷歌的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;
}
的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;
}
但是它仍然顯示我的錯誤: 對谷歌Azure的身份驗證是否設置正確,因爲我有直到最近一直在使用這種設置一個月。任何人都有同樣的問題或任何想法如何解決這個問題?
我正在處理同樣的問題,我得到的所有建議都是用原生iOS代碼編寫的。我正在處理前端使用JS和HTML的傳統Ruby on Rails應用程序。我沒有用JS做OAuth。我是Ruby的任何東西,但我認爲這個改變基本上殺了我的獨立應用程序。 –