mtchavez / ueberauth_gitlab

Gitlab OAuth2 Strategy fo Überauth
Other
7 stars 7 forks source link

GitLab Terms of Service error #65

Closed olavolav closed 3 years ago

olavolav commented 4 years ago

Using ueberauth_gitlab with a new user (or I'm assuming after GitLab has updated it's terms) causes the following error in lib/ueberauth/strategy/gitlab.ex:2021 in fetch_user/2:

no case clause matching: {:error, %OAuth2.Response{body: %{"message" => "403 Forbidden - You (@USERNAME) must accept the Terms of Service in order to perform this action. Please access GitLab from a web browser to accept these terms."}, headers: [{"server", "nginx"}, {"date", "Fri, 27 Mar 2020 16:40:11 GMT"}, {"content-type", "application/json"}, {"content-length", "180"}, {"cache-control", "no-cache"}, {"vary", "Origin"}, {"x-content-type-options", "nosniff"}, {"x-frame-options", "SAMEORIGIN"}, {"x-request-id", "QPr4sfby1l2"}, {"x-runtime", "0.173385"}, {"ratelimit-limit", "600"}, {"ratelimit-observed", "1"}, {"ratelimit-remaining", "599"}, {"ratelimit-reset", "1585327278"}, {"ratelimit-resettime", "Fri, 27 Mar 2020 16:41:18 GMT"}, {"gitlab-lb", "fe-01-lb-gprd"}, {"gitlab-sv", "localhost"}], status_code: 403}}

(Log anonymized)

This can be fixed, as the message from GitLab descibes, by logging into GitLab manually and accepting the terms.

And idea how to catch that and diplay a helpful message to the user, rather than a 500 error?

olavolav commented 4 years ago

@mtchavez Perhaps would you have any insight here?

olavolav commented 3 years ago

Outdated, closing