【发布时间】:2017-06-17 04:25:14
【问题描述】:
希望有人以前遇到过这个问题;
我正在 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....”启动浏览器
代码sn-p:
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;
}
提前致谢:)
干杯, 保罗
【问题讨论】:
-
我在控件的发行说明中发现了这个小宝石:- UWP(将构建,但已知在运行时不起作用)似乎我在用这种方法浪费我的时间。
标签: google-api google-oauth google-api-dotnet-client google-api-webmasters