Skip to content

Commit

Permalink
try this part again
Browse files Browse the repository at this point in the history
  • Loading branch information
kuannie1 committed Apr 16, 2024
1 parent 5fe29e8 commit 7d477e1
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions oidc_cli/oidc_impl/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ func (c *Client) idTokenFromOauth2Token(
// RefreshToken will fetch a new token
func (c *Client) RefreshToken(ctx context.Context, oldToken *Token) (*Token, error) {
logrus.Debugf("refresh scopes: %#v", c.oauthConfig.Scopes)
logrus.Debugf("oldToken: %#v", oldToken)
newToken, err := c.refreshToken(ctx, oldToken)
// if we could refresh successfully, do so.
// otherwise try a new token
Expand Down Expand Up @@ -190,15 +191,16 @@ func (c *Client) Exchange(ctx context.Context, code string, codeVerifier string)
params := []oauth2.AuthCodeOption{oauth2.SetAuthURLParam("grant_type", "authorization_code"),
oauth2.SetAuthURLParam("code_verifier", codeVerifier),
oauth2.SetAuthURLParam("client_id", c.oauthConfig.ClientID),
oauth2.SetAuthURLParam("scopes", format_scopes(ctx, c.oauthConfig.Scopes)),
}

if len(c.oauthConfig.Scopes) != 0 {
scope_str := format_scopes(ctx, c.oauthConfig.Scopes)
params = append(params, oauth2.SetAuthURLParam("scopes", scope_str))
logrus.Debugf("scopes: %s", scope_str)
} else {
logrus.Debug("no scopes set")
}
// if len(c.oauthConfig.Scopes) != 0 {
// scope_str := format_scopes(ctx, c.oauthConfig.Scopes)
// params = append(params, oauth2.SetAuthURLParam("scopes", scope_str))
// logrus.Debugf("scopes: %s", scope_str)
// } else {
// logrus.Debug("no scopes set")
// }
token, err := c.oauthConfig.Exchange(
ctx,
code,
Expand Down

0 comments on commit 7d477e1

Please sign in to comment.