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 #204

Closed

Conversation

shipperizer
Copy link
Contributor

@shipperizer shipperizer commented Nov 11, 2024

workaround to deal with golang/oauth2#320

didrocks and others added 2 commits October 14, 2024 10:46
Some providers, like google, request a client secret for the device
authentication. Make it optional, so that the admin can set it if
required in the generic broker.
workaround to deal with #golang/oauth2/320
@shipperizer shipperizer requested a review from a team as a code owner November 11, 2024 10:39
Comment on lines +323 to +331

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)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a nit:

Suggested change
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)
var authOpt oauth2.AuthCodeOption
if secret := session.authCfg.oauth.ClientSecret; secret != "" {
authOpt = oauth2.SetAuthURLParam("client_secret", secret)
}
response, err := session.authCfg.oauth.DeviceAuth(ctx, authOpt)

Copy link
Collaborator

@3v1n0 3v1n0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests are crashing, so please check them.

Also please improve the commit message to make it clearer what's the error we're workarounding here without having to go the whole details of the linked issue.

@adombeck
Copy link
Contributor

I would also appreciate an actual link to the issue instead of #golang/oauth2/320. Thanks!

@3v1n0
Copy link
Collaborator

3v1n0 commented Nov 12, 2024

I would also appreciate an actual link to the issue instead of #golang/oauth2/320. Thanks!

Yeah, I wanted to mention that too for us old school git log users 😂

@didrocks didrocks deleted the branch ubuntu:optional_client_secret November 12, 2024 17:11
@didrocks didrocks closed this Nov 12, 2024
@didrocks
Copy link
Member

Now that #178 is merged, do you mind rebasing on it and target the main branch directly?

Also, a small comment explaining which providers needs this and the details would be great too! Thanks :)

@shipperizer shipperizer changed the title fix: set AuthURLParam to set client id and secret fix: use AuthURLParam to set client id and secret Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants