Class: OmniAuth::Strategies::Vis
- Inherits:
-
OAuth2
- Object
- OAuth2
- OmniAuth::Strategies::Vis
- Defined in:
- lib/omniauth/strategies/vis.rb
Instance Method Summary collapse
-
#callback_url ⇒ Object
to fix always getting invalid_grant error see github.com/omniauth/omniauth-oauth2/issues/81#issuecomment-231442739.
-
#on_path?(path) ⇒ Boolean
Fix strange bugs with urls containing double / like dhamma.org//oauth/callback.
- #raw_info ⇒ Object
- #setup_phase ⇒ Object
Instance Method Details
#callback_url ⇒ Object
to fix always getting invalid_grant error see github.com/omniauth/omniauth-oauth2/issues/81#issuecomment-231442739
41 42 43 |
# File 'lib/omniauth/strategies/vis.rb', line 41 def callback_url full_host + script_name + callback_path end |
#on_path?(path) ⇒ Boolean
Fix strange bugs with urls containing double / like dhamma.org//oauth/callback
35 36 37 |
# File 'lib/omniauth/strategies/vis.rb', line 35 def on_path?(path) current_path.squeeze('/').casecmp(path.squeeze('/')).zero? end |
#raw_info ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/omniauth/strategies/vis.rb', line 45 def raw_info return @raw_info if @raw_info.present? @raw_info = if .jwt_shared_secret.present? # get info from the JWT token, so we save an API call JWT.decode( access_token.token, .jwt_shared_secret, true, { algorithm: "hs512" } ).first["user"] else # get info from API access_token.get("/api/v1/me.json").parsed end end |
#setup_phase ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/omniauth/strategies/vis.rb', line 18 def setup_phase # configure Oauth2 client_options.site from a custom server_url option ..site = .server_url # Authorize all params to be passed to VIS . = request.params.to_h end |