【发布时间】:2014-02-14 03:02:54
【问题描述】:
我正在使用 Google API 预览版 (1.7.0) 通过 OAuth2 授权用户。我一直在关注sample MVC code。这是我对FlowMetadata的实现:
private static readonly IAuthorizationCodeFlow flow = ...; // Implementation of tokens
public static async Task<Google.Apis.Auth.OAuth2.Web.AuthorizationCodeWebApp.AuthResult> GetCredentials(Controller controller, CancellationToken cancellationToken) {
var result = await new AuthorizationCodeMvcApp(controller, new Models.Generic.AppFlowMetadata()).AuthorizeAsync(cancellationToken);
if (result.Credential != null)
{
// Struggling here. How do I make a request to get the e-mail address?
}
}
我现在有一个有效的UserCredential 和访问令牌,但我找不到任何用于访问用户信息的托管 API。我确实找到了this question,但这似乎假设我只是提出原始请求,而不是使用官方库。
如何获取用户的电子邮件地址?
【问题讨论】:
-
你能发
private static readonly IAuthorizationCodeFlow flow = ...; // Implementation of tokens的代码吗?实际上我被困在那个点上并且没有得到任何解决方案。这是link我的问题 -
现在我遇到了这个问题。 My Question
标签: c# .net asp.net-mvc google-api-dotnet-client