Skip to content

Commit

Permalink
oidc: Fix the way we call UserInfo
Browse files Browse the repository at this point in the history
The UserInfo endpoint is called with an OAuth2 access token. The access
token expires after a while and then we must renew it with the refresh
token. Update the code so that it takes care of renewing the access
token.

Signed-off-by: Yannis Zarkadas <[email protected]>
  • Loading branch information
yanniszark committed Jul 12, 2020
1 parent 45ba7c7 commit 5d71b3f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion server.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ func (s *server) callback(w http.ResponseWriter, r *http.Request) {

// UserInfo endpoint to get claims
claims := map[string]interface{}{}
userInfo, err := GetUserInfo(ctx, s.provider, oauth2.StaticTokenSource(oauth2Tokens))
userInfo, err := GetUserInfo(ctx, s.provider, s.oauth2Config.TokenSource(ctx, oauth2Tokens))
if err != nil {
logger.Errorf("Not able to fetch userinfo: %v", err)
returnMessage(w, http.StatusInternalServerError, "Not able to fetch userinfo.")
Expand Down

0 comments on commit 5d71b3f

Please sign in to comment.