希望有人以前遇到过这个问题;
我正在 Windows 10 上构建一个通用 Windows 平台 (UWP) 应用程序,该应用程序使用来自 Google Web Master Tools API 的数据,当我尝试使用 Google Web Authorization Broker 进行授权时,我遇到了以下异常:
InnerException = {System.NotSupportedException:无法使用“ https://accounts.google.com/o/oauth2/v2/auth?access_type=offline&response_type=code&client_id=437110116900-jfsnbikhkj8l4aetubtkn52ggki45nm0.apps.googleusercontent.com&redirect_uri=http:%启动浏览器2F%2F127 ....
代码片段:
string[] scopes = new string[] {
WebmastersService.Scope.Webmasters
};
using (var stream = new FileStream("client_secret.json",
FileMode.Open, FileAccess.Read))
{
UserCredential credential = GoogleWebAuthorizationBroker.AuthorizeAsync(
GoogleClientSecrets.Load(stream).Secrets,
scopes,
userName,
CancellationToken.None,
new FileDataStore(".", true)).Result;
}
提前致谢 :)
干杯,保罗