fix: device code pending HTTP response

As per RFC8628 section 3.5, https://datatracker.ietf.org/doc/html/rfc8628#section-3.5
the authorization_pending response should extend RFC6749 section 5.2,
https://datatracker.ietf.org/doc/html/rfc6749#section-5.2 which
specifies that the HTTP response code should be 400, Bad Request.

Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
This commit is contained in:
Doug Goldstein
2025-07-01 20:08:03 -05:00
parent 7208747072
commit fbcc76f779
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -249,7 +249,7 @@ func (s *Server) handleDeviceToken(w http.ResponseWriter, r *http.Request) {
if slowDown {
s.tokenErrHelper(w, deviceTokenSlowDown, "", http.StatusBadRequest)
} else {
s.tokenErrHelper(w, deviceTokenPending, "", http.StatusUnauthorized)
s.tokenErrHelper(w, deviceTokenPending, "", http.StatusBadRequest)
}
case deviceTokenComplete:
codeChallengeFromStorage := deviceToken.PKCE.CodeChallenge
+1 -1
View File
@@ -459,7 +459,7 @@ func TestDeviceTokenResponse(t *testing.T) {
},
testDeviceCode: "f00bar",
expectedServerResponse: deviceTokenPending,
expectedResponseCode: http.StatusUnauthorized,
expectedResponseCode: http.StatusBadRequest,
},
{
testName: "Invalid Grant Type",