From a6776d0ba2f1db7266bd1110d991d30da841c8d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mislav=20Marohni=C4=87?= Date: Fri, 14 Aug 2020 17:31:23 +0200 Subject: [PATCH] Allow more HTTP 40x codes to trigger fallback to old OAuth flow I want to avoid falling back to the old OAuth flow for just any HTTP 4xx/5xx because other statuses should be allowed to surface a problem with a request or the server. --- auth/oauth.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/auth/oauth.go b/auth/oauth.go index a38e0c8eb..adc5231ef 100644 --- a/auth/oauth.go +++ b/auth/oauth.go @@ -57,7 +57,7 @@ func (oa *OAuthFlow) ObtainAccessToken() (accessToken string, err error) { } defer resp.Body.Close() - if resp.StatusCode == 404 { + if resp.StatusCode == 401 || resp.StatusCode == 403 || resp.StatusCode == 404 { // OAuth Device Flow is not available; continue with OAuth browser flow with a // local server endpoint as callback target return oa.localServerFlow()