Class: OmniAuth::Strategies::GustoOauth2
- Inherits:
-
OAuth2
- Object
- OAuth2
- OmniAuth::Strategies::GustoOauth2
- Defined in:
- lib/omniauth/strategies/gusto_oauth2.rb
Overview
OmniAuth strategy for Gusto OAuth2.
Gusto uses standard OAuth2 with 2-hour access tokens and single-use refresh tokens. The authorize and token endpoints are on api.gusto.com. User info is fetched via GET /v1/me.
Instance Method Summary collapse
-
#build_access_token ⇒ Object
Override to strip query params from callback_url for redirect_uri matching.
- #raw_info ⇒ Object
Instance Method Details
#build_access_token ⇒ Object
Override to strip query params from callback_url for redirect_uri matching. Gusto requires the redirect_uri to match exactly.
54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/omniauth/strategies/gusto_oauth2.rb', line 54 def build_access_token redirect_uri = callback_url.sub(/\?.*/, '') log(:info, "Token exchange — site: #{client.site}, redirect_uri: #{redirect_uri}") verifier = request.params['code'] client.auth_code.get_token( verifier, { redirect_uri: redirect_uri }.merge(token_params.to_hash(symbolize_keys: true)), deep_symbolize(.auth_token_params) ) rescue ::OAuth2::Error => e log(:error, "Token exchange FAILED: status=#{e.response&.status} body=#{e.response&.body}") raise end |
#raw_info ⇒ Object
48 49 50 |
# File 'lib/omniauth/strategies/gusto_oauth2.rb', line 48 def raw_info @raw_info ||= fetch_user_and_company_info end |