Fix handling of HTTP 403 in Device Flow detection

This commit is contained in:
Mislav Marohnić 2020-10-01 17:09:14 +02:00
parent 091d550cde
commit 5f8648159d

View file

@ -69,7 +69,7 @@ func (oa *OAuthFlow) ObtainAccessToken() (accessToken string, err error) {
}
}
if resp.StatusCode == http.StatusUnauthorized || resp.StatusCode == http.StatusPaymentRequired ||
if resp.StatusCode == http.StatusUnauthorized || resp.StatusCode == http.StatusForbidden ||
resp.StatusCode == http.StatusNotFound || resp.StatusCode == http.StatusUnprocessableEntity ||
(resp.StatusCode == http.StatusBadRequest && values != nil && values.Get("error") == "unauthorized_client") {
// OAuth Device Flow is not available; continue with OAuth browser flow with a