-
Notifications
You must be signed in to change notification settings - Fork 1.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
fix: use /token endpoint to get tokens with device flow #2010
fix: use /token endpoint to get tokens with device flow #2010
Conversation
Should we deprecate the |
Yes, I think so. I left a to-do but did nothing with deprecation. Maybe adding some sort of warning on endpoint call will be good enough. Something like this. |
For me, deprecation would mean
|
Signed-off-by: m.nabokikh <[email protected]>
Signed-off-by: m.nabokikh <[email protected]>
ab8b38b
to
9ed5cc0
Compare
server/deviceflowhandlers.go
Outdated
s.logger.Warn(`Request to the deprecated "/device/token" endpoint was received.`) | ||
s.logger.Warn(`The "/device/token" endpoint will be removed in a future release.`) |
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.
Can we make this a single log line? And maybe make the message a bit more concise?
server/server_test.go
Outdated
@@ -1583,7 +1583,7 @@ func TestOAuth2DeviceFlow(t *testing.T) { | |||
|
|||
// Hit the Token Endpoint, and try and get an access token | |||
tokenURL, _ := url.Parse(issuer.String()) | |||
tokenURL.Path = path.Join(tokenURL.Path, "/device/token") | |||
tokenURL.Path = path.Join(tokenURL.Path, "/token") |
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.
Can we add a test with the old path to make sure it's still functional?
server/deviceflowhandlers.go
Outdated
@@ -151,7 +151,10 @@ func (s *Server) handleDeviceCode(w http.ResponseWriter, r *http.Request) { | |||
} | |||
} | |||
|
|||
func (s *Server) handleDeviceToken(w http.ResponseWriter, r *http.Request) { | |||
func (s *Server) handleDeviceTokenGrant(w http.ResponseWriter, r *http.Request) { |
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 this name is a bit confusing and ambiguous with the handleDeviceToken
name. Maybe call it something like deprecatedDeviceTokenHandler
or handleDeviceTokenDeprecated
.
Signed-off-by: m.nabokikh <[email protected]>
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.
LGTM, thanks
@sagikazarmark Anything preventing this from being merged/closed? |
Signed-off-by: m.nabokikh [email protected]
Overview
rfc6749#section-3.2
/token
endpoint responding to requests with device auth grant/token
endpointWhat this PR does / why we need it
Fixes #1953
As was mentioned in the issue above, the main problem that the token endpoint is not discoverable.
Special notes for your reviewer
This MR leaves the possibility to get a token from the
/device/token
endpoint.Does this PR introduce a user-facing change?
There are no breaking changes, but it will be better to avoid using /device/token endpoint in the feature.