Skip to content

Commit

Permalink
fix: use AuthURLParam to set client id and secret
Browse files Browse the repository at this point in the history
workaround to deal with golang/oauth2#320
  • Loading branch information
shipperizer committed Nov 12, 2024
1 parent 14fad3f commit 714f7d1
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion internal/broker/broker.go
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,15 @@ func (b *Broker) generateUILayout(session *sessionInfo, authModeID string) (map[
case authmodes.Device, authmodes.DeviceQr:
ctx, cancel := context.WithTimeout(context.Background(), maxRequestDuration)
defer cancel()
response, err := session.authCfg.oauth.DeviceAuth(ctx)

var opt oauth2.AuthCodeOption

if secret := session.authCfg.oauth.ClientSecret; secret != "" {
opt = oauth2.SetAuthURLParam("client_secret", secret)
}

response, err := session.authCfg.oauth.DeviceAuth(ctx, opt)

if err != nil {
return nil, fmt.Errorf("could not generate Device Authentication code layout: %v", err)
}
Expand Down

0 comments on commit 714f7d1

Please sign in to comment.