-
Notifications
You must be signed in to change notification settings - Fork 1k
oauth2: add device flow support #578
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
Conversation
|
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 |
|
Message from Gopher Robot: Patch Set 1: Congratulations on opening your first change. Thank you for your contribution! Next steps: Most changes in the Go project go through a few rounds of revision. This can be Please don’t reply on this GitHub thread. Visit golang.org/cl/420635. |
c6bb426 to
ca020c8
Compare
|
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 |
oauth2.go
Outdated
| "client_id": {c.ClientID}, | ||
| "grant_type": {"urn:ietf:params:oauth:grant-type:device_code"}, | ||
| "device_code": {da.DeviceCode}, | ||
| "code": {da.DeviceCode}, |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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>
ca020c8 to
158ee2d
Compare
|
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 |
|
Implemented in e3fb0fb |
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