Skip to content

A platform for community discussion. Free, open, simple.

FIX: Avoid clock skew issues when logging in with Google (#11442)

David Taylor17fcdd60c1b2
diff --git a/lib/auth/google_oauth2_authenticator.rb b/lib/auth/google_oauth2_authenticator.rb
index fd401a87b66..59b0caa2c78 100644
--- a/lib/auth/google_oauth2_authenticator.rb
+++ b/lib/auth/google_oauth2_authenticator.rb
@@ -29,6 +29,12 @@ class Auth::GoogleOAuth2Authenticator < Auth::ManagedAuthenticator
if (google_oauth2_prompt = SiteSetting.google_oauth2_prompt).present?
strategy.options[:prompt] = google_oauth2_prompt.gsub("|", " ")
end
+
+ # All the data we need for the `info` and `credentials` auth hash
+ # are obtained via the user info API, not the JWT. Using and verifying
+ # the JWT can fail due to clock skew, so let's skip it completely.
+ # https://github.com/zquestz/omniauth-google-oauth2/pull/392
+ strategy.options[:skip_jwt] = true
}
}
omniauth.provider :google_oauth2, options