OAuth: persisting the id token (#42938)

* OAuth: persisting the id token

* OAuth: verifies that the idtoken gets persistet in the database
This commit is contained in:
Leonard Gram
2021-12-14 15:22:10 +01:00
committed by GitHub
parent 4a3961400a
commit 5d18834deb
5 changed files with 39 additions and 3 deletions

View File

@@ -68,6 +68,11 @@ func (o *Service) GetCurrentOAuthToken(ctx context.Context, user *models.SignedI
RefreshToken: authInfoQuery.Result.OAuthRefreshToken,
TokenType: authInfoQuery.Result.OAuthTokenType,
}
if authInfoQuery.Result.OAuthIdToken != "" {
persistedToken = persistedToken.WithExtra(map[string]interface{}{"id_token": authInfoQuery.Result.OAuthIdToken})
}
// TokenSource handles refreshing the token if it has expired
token, err := connect.TokenSource(ctx, persistedToken).Token()
if err != nil {