我正在使用Google API预览版(1.7.0)通过OAuth2授权用户。我一直在关注sample MVC code。这是我实现FlowMetadata
:使用Google API for .NET访问用户信息
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,但这似乎认为我只是提出原始请求,而不是使用官方库。
如何获取用户的电子邮件地址?
你可以张贴的'私人静态只读IAuthorizationCodeFlow流码= ...; //执行令牌。其实我被困在那一点,并没有得到任何解决方案。这里是[链接](https://stackoverflow.com/questions/44842813/google-calendar-api-working-fine-locally-but-not-raising-its-authentication-on-s)到我的问题 – Divya
现在我会遇到这个问题。 [我的问题](https://stackoverflow.com/questions/45103628/access-to-the-path-c-windows-system32-config-systemprofile-is-denied) – Divya