Ich verwende die Google APIs-Vorschau (1.7.0), um einen Benutzer über OAuth2 zu autorisieren. Ich habe die sample MVC code verfolgt. Dies ist meine Implementierung von FlowMetadata
:Zugriff auf Benutzerinformationen mit Google APIs für .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?
}
}
ich jetzt eine gültige UserCredential
und daher Zugriffstoken haben, aber ich kann nicht alle verwalteten APIs für den Zugriff auf den Benutzer Informationen finden. Ich habe this question gefunden, aber das scheint anzunehmen, dass ich nur rohe Anfragen mache, anstatt die offizielle Bibliothek zu benutzen.
Wie kann ich die E-Mail-Adresse des Benutzers abrufen?
Können Sie nach Code von 'private static nur lesbar IAuthorizationCodeFlow Flow = ...; // Implementierung von Token'. Eigentlich stecke ich an diesem Punkt und bekomme keine Lösung. Hier ist [link] (https://stackoverflow.com/questions/44842813/google-calendar-api-working-fine-locally-but-not-raising-its-authentication-on-s-s) zu meiner Frage – Divya
gerade jetzt ich bekomme dieses Problem. [Meine Frage] (https://stackoverflow.com/questions/45103628/access-to-the-path-c-windows-system32-config-systemprofile-is-denied) – Divya