Skip to content

Commit

Permalink
fix(tokenExchange): use correct token type for userInfo requests (#3336)
Browse files Browse the repository at this point in the history
Signed-off-by: Chris H <33393789+MrDeerly@users.noreply.github.com>
  • Loading branch information
0x0dr1y authored Feb 9, 2024
1 parent fdb4dc6 commit 79d5874
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion connector/oidc/oidc.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit 79d5874

Please sign in to comment.