diff --git a/Library/Homebrew/utils/github.rb b/Library/Homebrew/utils/github.rb index cdeb22a30d844d630df055e64a549ccc9727775e..c14f75cba12f6ea8628a5d49c08b86c8832abdbf 100644 --- a/Library/Homebrew/utils/github.rb +++ b/Library/Homebrew/utils/github.rb @@ -141,9 +141,8 @@ module GitHub def api_credentials_error_message(response_headers, needed_scopes) return if response_headers.empty? - unauthorized = (response_headers["http/1.1"] == "401 Unauthorized") scopes = response_headers["x-accepted-oauth-scopes"].to_s.split(", ") - return unless unauthorized && scopes.blank? + return if scopes.present? needed_human_scopes = needed_scopes.join(", ") credentials_scopes = response_headers["x-oauth-scopes"]