Class: OmniAuth::Strategies::OAuth2
- Inherits:
-
Object
- Object
- OmniAuth::Strategies::OAuth2
- Defined in:
- lib/patch/omniauth-oauth2.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#callback_phase ⇒ Object
rubocop:disable AbcSize, CyclomaticComplexity, MethodLength, PerceivedComplexity.
- #callback_url ⇒ Object
Instance Method Details
#callback_phase ⇒ Object
rubocop:disable AbcSize, CyclomaticComplexity, MethodLength, PerceivedComplexity
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/patch/omniauth-oauth2.rb', line 2 def callback_phase # rubocop:disable AbcSize, CyclomaticComplexity, MethodLength, PerceivedComplexity error = request.params["error_reason"] || request.params["error"] if error fail!(error, CallbackError.new(request.params["error"], request.params["error_description"] || request.params["error_reason"], request.params["error_uri"])) elsif !.provider_ignores_state && (request.params["state"].to_s.empty? || request.params["state"] != session.delete("omniauth.state")) fail!(:csrf_detected, CallbackError.new(:csrf_detected, "CSRF detected")) else self.access_token = build_access_token fail!(:token_expired, CallbackError.new(:token_expired,'Token has expired, refresh and try again.')) if access_token.expired? super end rescue ::OAuth2::Error, CallbackError => e fail!(:invalid_credentials, e) rescue ::Timeout::Error, ::Errno::ETIMEDOUT => e fail!(:timeout, e) rescue ::SocketError => e fail!(:failed_to_connect, e) end |
#callback_url ⇒ Object
21 22 23 |
# File 'lib/patch/omniauth-oauth2.rb', line 21 def callback_url full_host + script_name + callback_path end |