-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
x/oauth2: Device authorization grant #58126
Comments
This proposal has been added to the active column of the proposals project |
/cc @rolandshoemaker |
Seems like there is a desire for this (based on the handful of partial implementations that appear to exist). Based on a quick skim of the RFC the proposed API looks reasonable, although |
Good idea. I'll update the proposal |
I updated the top comment to change the method name from Poll to DeviceAccessToken? Are there any other remaining concerns? |
Based on the discussion above, this proposal seems like a likely accept. |
No change in consensus, so accepted. 🎉 |
Implementation ready for review at https://go-review.googlesource.com/c/oauth2/+/450155 |
@rsc @rolandshoemaker I've added you as reviewers at https://go-review.googlesource.com/c/oauth2/+/450155 |
@bcmills https://go-review.googlesource.com/c/oauth2/+/450155 is ready for review |
Change https://go.dev/cl/450155 mentions this issue: |
Device Authorization Grant following RFC 8628 https://datatracker.ietf.org/doc/html/rfc8628 Tested with GitHub Fixes golang#418 Fixes golang/go#58126 Co-authored-by: cmP <[email protected]> Change-Id: Id588867110c6a5289bf1026da5d7ead88f9c7d14 GitHub-Last-Rev: 9a126d7 GitHub-Pull-Request: golang#609 Reviewed-on: https://go-review.googlesource.com/c/oauth2/+/450155 Commit-Queue: Bryan Mills <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Than McIntosh <[email protected]> Auto-Submit: Bryan Mills <[email protected]> Run-TryBot: Matt Hickford <[email protected]> Reviewed-by: Bryan Mills <[email protected]> Run-TryBot: Bryan Mills <[email protected]>
issue golang/oauth2#418
Objective: support OAuth 2.0 Device Authorization Grant, RFC 8628 (Proposed Standard since 2019)
Add DeviceAuthURL field to type Endpoint
type Endpoint struct { AuthURL string + DeviceAuthURL string TokenURL string
Define a function to make the Device Authorization response and define a new struct to hold the response.
Note that
Expiry
is a time.Time even though the RFC 8628 json parameterexpires_in
is an int counting seconds. This convenience follows the design of oauth2.Token.Expiry. Custom JSON marshalling is necessary.Here's a change including implementation golang/oauth2#609
Working example of an app using the proposed API to add support for headless devices in ~20 lines https://github.com/hickford/git-credential-oauth/pull/9/files#diff-2873f79a86c0d8b3335cd7731b0ecf7dd4301eb19a82ef7a1cba7589b5252261
The text was updated successfully, but these errors were encountered: