fixes a typo & ask for events permission

vnext
Paul Schneider 6 years ago
parent 861008f5d0
commit 7d07079f94
1 changed files with 5 additions and 4 deletions

@ -133,11 +133,12 @@ namespace Yavsc
YavscGoogleAppOptions = new YavscGoogleOptions YavscGoogleAppOptions = new YavscGoogleOptions
{ {
ClientId = Configuration["Authentication:Google:ServiceAccount:client_id"], ClientId = Configuration["Authentication:Google:ServiceAccount:client_id"],
ClientSecret = Configuration["Authentication:Google:SerivceAccount:client_secret"], ClientSecret = Configuration["Authentication:Google:ServiceAccount:client_secret"],
AccessType = "offline", AccessType = "offline",
Scope = { "profile", "https://www.googleapis.com/auth/plus.login", Scope = { "profile", "https://www.googleapis.com/auth/plus.login",
"https://www.googleapis.com/auth/admin.directory.resource.calendar", "https://www.googleapis.com/auth/admin.directory.resource.calendar",
"https://www.googleapis.com/auth/calendar" }, "https://www.googleapis.com/auth/calendar",
"https://www.googleapis.com/auth/calendar.events"},
SaveTokensAsClaims = true, SaveTokensAsClaims = true,
UserInformationEndpoint = "https://www.googleapis.com/plus/v1/people/me", UserInformationEndpoint = "https://www.googleapis.com/plus/v1/people/me",
Events = new OAuthEvents Events = new OAuthEvents
@ -150,7 +151,7 @@ namespace Yavsc
var gcontext = context as GoogleOAuthCreatingTicketContext; var gcontext = context as GoogleOAuthCreatingTicketContext;
context.Identity.AddClaim(new Claim(YavscClaimTypes.GoogleUserId, gcontext.GoogleUserId)); context.Identity.AddClaim(new Claim(YavscClaimTypes.GoogleUserId, gcontext.GoogleUserId));
var dbContext = serviceScope.ServiceProvider.GetService<ApplicationDbContext>(); var dbContext = serviceScope.ServiceProvider.GetService<ApplicationDbContext>();
/*
var store = serviceScope.ServiceProvider.GetService<IDataStore>(); var store = serviceScope.ServiceProvider.GetService<IDataStore>();
await store.StoreAsync(gcontext.GoogleUserId, new TokenResponse { await store.StoreAsync(gcontext.GoogleUserId, new TokenResponse {
AccessToken = gcontext.TokenResponse.AccessToken, AccessToken = gcontext.TokenResponse.AccessToken,
@ -158,7 +159,7 @@ namespace Yavsc
TokenType = gcontext.TokenResponse.TokenType, TokenType = gcontext.TokenResponse.TokenType,
ExpiresInSeconds = int.Parse(gcontext.TokenResponse.ExpiresIn), ExpiresInSeconds = int.Parse(gcontext.TokenResponse.ExpiresIn),
IssuedUtc = DateTime.Now IssuedUtc = DateTime.Now
}); */ });
await dbContext.StoreTokenAsync (gcontext.GoogleUserId, await dbContext.StoreTokenAsync (gcontext.GoogleUserId,
gcontext.TokenResponse.Response, gcontext.TokenResponse.Response,
gcontext.TokenResponse.AccessToken, gcontext.TokenResponse.AccessToken,

Loading…