Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use AuthURLParam to set client id and secret #216

Merged
merged 1 commit into from
Nov 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion internal/broker/broker.go
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,20 @@ 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 authOpts []oauth2.AuthCodeOption

// workaround to cater for fully RFC compliant oauth2 server which require this
// extra option, public providers tend to have bespoke implementation for passing client
// credentials that completely bypass this
// full explanation in https://github.com/golang/oauth2/issues/320
if secret := session.authCfg.oauth.ClientSecret; secret != "" {
// TODO @shipperizer verificationMethod should be a configurable value
verificationMethod := "client_post"
authOpts = append(authOpts, oauth2.SetAuthURLParam(verificationMethod, secret))
}

response, err := session.authCfg.oauth.DeviceAuth(ctx, authOpts...)
if err != nil {
return nil, fmt.Errorf("could not generate Device Authentication code layout: %v", err)
}
Expand Down
Loading