X Tutup
Skip to content

Commit cb4cc72

Browse files
committed
Handle HTTP 422 response to OAuth Device flow detection
If HTTP 422 is encountered, assume that OAuth Device Flow is unavailable and fall back to OAuth app authorization flow.
1 parent fd31007 commit cb4cc72

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

auth/oauth.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ func (oa *OAuthFlow) ObtainAccessToken() (accessToken string, err error) {
6969
}
7070
}
7171

72-
if resp.StatusCode == 401 || resp.StatusCode == 403 || resp.StatusCode == 404 ||
72+
if resp.StatusCode == 401 || resp.StatusCode == 403 || resp.StatusCode == 404 || resp.StatusCode == 422 ||
7373
(resp.StatusCode == 400 && values != nil && values.Get("error") == "unauthorized_client") {
7474
// OAuth Device Flow is not available; continue with OAuth browser flow with a
7575
// local server endpoint as callback target

0 commit comments

Comments
 (0)
X Tutup