From 5d71b3fbe011f97ca38f0cd05bd2e45f2c272ff2 Mon Sep 17 00:00:00 2001 From: Yannis Zarkadas Date: Sat, 11 Jul 2020 17:08:37 +0300 Subject: [PATCH] oidc: Fix the way we call UserInfo 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 --- server.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server.go b/server.go index d75100bc..0285718f 100644 --- a/server.go +++ b/server.go @@ -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.")