From 7d07079f94b949ff96a8bf7cd3bacca1255ad69b Mon Sep 17 00:00:00 2001 From: Paul Schneider Date: Sun, 23 Dec 2018 21:12:06 +0000 Subject: [PATCH] fixes a typo & ask for events permission --- Yavsc/Startup/Startup.OAuth.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Yavsc/Startup/Startup.OAuth.cs b/Yavsc/Startup/Startup.OAuth.cs index ed4a8687..b3e9a333 100644 --- a/Yavsc/Startup/Startup.OAuth.cs +++ b/Yavsc/Startup/Startup.OAuth.cs @@ -133,11 +133,12 @@ namespace Yavsc YavscGoogleAppOptions = new YavscGoogleOptions { ClientId = Configuration["Authentication:Google:ServiceAccount:client_id"], - ClientSecret = Configuration["Authentication:Google:SerivceAccount:client_secret"], + ClientSecret = Configuration["Authentication:Google:ServiceAccount:client_secret"], AccessType = "offline", Scope = { "profile", "https://www.googleapis.com/auth/plus.login", "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, UserInformationEndpoint = "https://www.googleapis.com/plus/v1/people/me", Events = new OAuthEvents @@ -150,7 +151,7 @@ namespace Yavsc var gcontext = context as GoogleOAuthCreatingTicketContext; context.Identity.AddClaim(new Claim(YavscClaimTypes.GoogleUserId, gcontext.GoogleUserId)); var dbContext = serviceScope.ServiceProvider.GetService(); - /* + var store = serviceScope.ServiceProvider.GetService(); await store.StoreAsync(gcontext.GoogleUserId, new TokenResponse { AccessToken = gcontext.TokenResponse.AccessToken, @@ -158,7 +159,7 @@ namespace Yavsc TokenType = gcontext.TokenResponse.TokenType, ExpiresInSeconds = int.Parse(gcontext.TokenResponse.ExpiresIn), IssuedUtc = DateTime.Now - }); */ + }); await dbContext.StoreTokenAsync (gcontext.GoogleUserId, gcontext.TokenResponse.Response, gcontext.TokenResponse.AccessToken,