Skip to content

Conversation

@marcosnils
Copy link

@marcosnils marcosnils commented Aug 1, 2022

This is a rebased follow-up of #356. I'm opening a new PR since the original author doesn't seem to be active anymore on GH

Signed-off-by: Marcos Lilljedahl marcosnils@gmail.com

@gopherbot
Copy link
Contributor

This PR (HEAD: c6bb426) has been imported to Gerrit for code review.

Please visit https://go-review.googlesource.com/c/oauth2/+/420635 to see it.

Tip: You can toggle comments from me using the comments slash command (e.g. /comments off)
See the Wiki page for more info

@gopherbot
Copy link
Contributor

Message from Gopher Robot:

Patch Set 1:

Congratulations on opening your first change. Thank you for your contribution!

Next steps:
A maintainer will review your change and provide feedback. See
https://go.dev/doc/contribute#review for more info and tips to get your
patch through code review.

Most changes in the Go project go through a few rounds of revision. This can be
surprising to people new to the project. The careful, iterative review process
is our way of helping mentor contributors and ensuring that their contributions
have a lasting impact.


Please don’t reply on this GitHub thread. Visit golang.org/cl/420635.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

This PR (HEAD: ca020c8) has been imported to Gerrit for code review.

Please visit https://go-review.googlesource.com/c/oauth2/+/420635 to see it.

Tip: You can toggle comments from me using the comments slash command (e.g. /comments off)
See the Wiki page for more info

oauth2.go Outdated
"client_id": {c.ClientID},
"grant_type": {"urn:ietf:params:oauth:grant-type:device_code"},
"device_code": {da.DeviceCode},
"code": {da.DeviceCode},
Copy link

Choose a reason for hiding this comment

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

code - extra parameter can be removed
in this comment #356 (comment)

interval = 5
}

for {
Copy link

Choose a reason for hiding this comment

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

and need fix this comment #356 (comment)

Copy link

Choose a reason for hiding this comment

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

I think the best solution would be to give the error or the token back, and the caller will decide how and how many times to call

Copy link
Author

Choose a reason for hiding this comment

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

the spec doesn't say that an error should be returned if the interval is not particularly specified. In most of the cases, the auth service should return this value. Setting the default interval to a safe value seems to me that's ok.

errTyp := parseError(err)
switch errTyp {
case errAccessDenied, errExpiredToken:
return tok, errors.New("oauth2: " + errTyp)
Copy link

Choose a reason for hiding this comment

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

It would be more convenient to immediately return a specialized error

Copy link
Author

Choose a reason for hiding this comment

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

we are returning the error here. Not sure what the proposal currently is

Signed-off-by: Marcos Lilljedahl <marcosnils@gmail.com>
@gopherbot
Copy link
Contributor

This PR (HEAD: 158ee2d) has been imported to Gerrit for code review.

Please visit https://go-review.googlesource.com/c/oauth2/+/420635 to see it.

Tip: You can toggle comments from me using the comments slash command (e.g. /comments off)
See the Wiki page for more info

@hickford hickford closed this Sep 7, 2023
@hickford
Copy link
Contributor

hickford commented Sep 7, 2023

Implemented in e3fb0fb

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