Windows 10 UWP App:GoogleWebAuthorizationBroker;无法启动浏览器异常

时间:2017-06-17 04:25:14

标签: google-api google-oauth google-api-dotnet-client google-api-webmasters

希望某人之前遇到过这个问题;

我正在Windows 10上构建一个使用Google Web Master Tools API数据的通用Windows平台(UWP)应用程序,当我尝试使用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;
                }

提前致谢:)

干杯, 保罗

1 个答案:

答案 0 :(得分:0)

Google APIs .net client library目前不支持UWP。见Investigate UWP support #983

问题是启动浏览器以验证库无法在UWP应用程序上执行此操作。