Но я не могу подключиться, у меня есть все готовые несоответствия перенаправления URI.Я разрабатываю ASP.NET MVC 5, C#, пробовал app.authgoogleAuth для OAuth2, но он не работает.
При запуске .auth.cs, у меня есть:
Код: Выделить всё
app.UseGoogleAuthentication(new GoogleOAuth2AuthenticationOptions()
{
ClientId = "xxxMyClientID",
ClientSecret = "xxxMyclientsecret"
});
Код: Выделить всё
private readonly IDataStore dataStore = new FileDataStore(GoogleWebAuthorizationBroker.Folder);
private async Task GetCredentialForApiAsync()
{
var initializer = new GoogleAuthorizationCodeFlow.Initializer
{
ClientSecrets = new ClientSecrets
{
ClientId = "xxxMyClientId",
ClientSecret = "xxxMyClientSecret",
},
Scopes = MyRequestedScopes.Scopes,
};
var flow = new GoogleAuthorizationCodeFlow(initializer);
var identity = await HttpContext.GetOwinContext().Authentication.GetExternalIdentityAsync(
DefaultAuthenticationTypes.ApplicationCookie);
var userId = identity.FindFirstValue(MyClaimTypes.GoogleUserId);
var token = await dataStore.GetAsync(userId);
return new UserCredential(flow, userId, token);
}
Может ли кто-нибудь мне помочь?
Спасибо
Подробнее здесь: https://stackoverflow.com/questions/787 ... nformation