【发布时间】:2014-05-03 05:20:09
【问题描述】:
我正在使用“Google.Apis.YouTube.v3 Client Library1.8.1.1050”Nuget 包来访问 Windows Phone 8 中的 API。我能够使用此 API 成功执行登录功能。只有使用经过身份验证的 Google 帐户详细信息登录,我才能在 YouTube API v3 上执行某些操作。我还可以使用此 API 从 Youtube 获取所有提要。现在,我在使用 Google API V3 oAuth2 时遇到了一个问题。 我正在使用以下代码使用 Google 帐户登录:
UserCredential credential;
using (var stream = new FileStream("clientdata.json", FileMode.Open, FileAccess.Read)){
credential = await GoogleWebAuthorizationBroker.AuthorizeAsync(
GoogleClientSecrets.Load(stream).Secrets,
// This OAuth 2.0 access scope allows for read-only access to the authenticated
// user's account, but not other types of account access.
new[] { YouTubeService.Scope.Youtubepartner },
"user",
CancellationToken.None);}
使用此代码,我可以成功登录并获取所有提要。但现在我的问题是如何使用 Google API v3 从 Windows Phone 8 应用程序中注销? 据我所知,此包中没有可用的方法来清除用户凭据。 现在,我正在调用一个网络服务
https://accounts.google.com/o/oauth2/revoke?token={访问令牌}
撤销当前的访问令牌,但这没有多大帮助。
如果我能得到任何帮助来解决这个问题,那就太好了。如果需要更正,请告诉我。 如果有人可以提供有关如何在 Windows Phone 中有效使用此 API 的文档或示例示例,那就更好了。
提前致谢
【问题讨论】:
标签: windows-phone-8 youtube-api google-api-dotnet-client