Browse Source

fix(tokenExchange): use correct token type for userInfo requests (#3336)

Signed-off-by: Chris H <33393789+MrDeerly@users.noreply.github.com>
pull/3345/head
Chris 2 years ago committed by GitHub
parent
commit
79d5874b35
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 5
      connector/oidc/oidc.go

5
connector/oidc/oidc.go

@ -433,7 +433,10 @@ func (c *oidcConnector) createIdentity(ctx context.Context, identity connector.I
// We immediately want to run getUserInfo if configured before we validate the claims.
// For token exchanges with access tokens, this is how we verify the token.
if c.getUserInfo {
userInfo, err := c.provider.UserInfo(ctx, oauth2.StaticTokenSource(token))
userInfo, err := c.provider.UserInfo(ctx, oauth2.StaticTokenSource(&oauth2.Token{
AccessToken: token.AccessToken,
TokenType: "Bearer", // The UserInfo endpoint requires a bearer token as per RFC6750
}))
if err != nil {
return identity, fmt.Errorf("oidc: error loading userinfo: %v", err)
}

Loading…
Cancel
Save