Xbox One C#上的Google登录问题 – GoogleWebAuthorizationBroker.AuthorizeAsync
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了Xbox One C#上的Google登录问题 – GoogleWebAuthorizationBroker.AuthorizeAsync,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含2136字,纯文字阅读大概需要4分钟。
内容图文
在Windows 10桌面/移动设备上运行时,此代码在我的UWP应用程序中运行正常,但是在Xbox One上我收到错误:
我的c#代码:
credential = await GoogleWebAuthorizationBroker.AuthorizeAsync(
new Uri("ms-appx:///Assets/client_secrets.json"),
new[] { "https://www.googleapis.com/auth/plus.profile.emails.read" },
"user",
CancellationToken.None);
return credential.Token.AccessToken;
以下是正在发生的步骤:
>点击谷歌登录btn
>谷歌登录界面正在加载
>我可以登录我的谷歌帐户
>登录窗口要求我授权该应用程序的权限
>此处发生错误:我从未获得Oauth令牌并收到以下错误消息:
错误:“成功”,描述:“WebAuthenticationBroker未返回代码或错误.详细信息:0”,Uri:“”
有人有这个问题吗?
我的project.json文件:
{
"dependencies": {
"Google.Apis": "1.15.0",
"Google.Apis.Auth": "1.15.0",
"Google.Apis.Core": "1.15.0",
"Microsoft.ApplicationInsights": "2.1.0",
"Microsoft.ApplicationInsights.PersistenceChannel": "1.2.3",
"Microsoft.ApplicationInsights.WindowsApps": "1.1.1",
"Microsoft.NETCore.UniversalWindowsPlatform": "5.2.2",
"Microsoft.Xaml.Behaviors.Uwp.Managed": "1.1.0",
"MvvmLightLibs": "5.3.0",
"Newtonsoft.Json": "9.0.1",
"NotificationsExtensions.Win10": "14295.0.1"
},
"frameworks": {
"uap10.0": {}
},
"runtimes": {
"win10-arm": {},
"win10-arm-aot": {},
"win10-x86": {},
"win10-x86-aot": {},
"win10-x64": {},
"win10-x64-aot": {}
}
}
对我做错了什么的想法?
解决方法:
就像富兰克林提出的那样,我选择了一个很好的旧WebAuthenticationBroker,如果其他人感兴趣,这里是一段代码:
String GoogleURL = "https://accounts.google.com/o/oauth2/auth?client_id="
+ Uri.EscapeDataString("ABC-DECF1234.apps.googleusercontent.com")
+ "&redirect_uri=" + Uri.EscapeDataString("urn:ietf:wg:oauth:2.0:oob")
+ "&response_type=code&scope=" + Uri.EscapeDataString("https://www.googleapis.com/auth/plus.profile.emails.read");
Uri StartUri = new Uri(GoogleURL);
Uri EndUri = new Uri("https://accounts.google.com/o/oauth2/approval?");
WebAuthenticationResult WebAuthenticationResult = await WebAuthenticationBroker.AuthenticateAsync(WebAuthenticationOptions.UseTitle, StartUri, EndUri);
if (WebAuthenticationResult.ResponseStatus == WebAuthenticationStatus.Success)
{
return WebAuthenticationResult.ResponseData.ToString();
}
内容总结
以上是互联网集市为您收集整理的Xbox One C#上的Google登录问题 – GoogleWebAuthorizationBroker.AuthorizeAsync全部内容,希望文章能够帮你解决Xbox One C#上的Google登录问题 – GoogleWebAuthorizationBroker.AuthorizeAsync所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。