Class: OmniAuth::Strategies::Patreon

Inherits:
OAuth2
  • Object
show all
Defined in:
lib/j1_app/omniauth/strategies/patreon.rb

Constant Summary collapse

DEFAULT_SCOPE =

OAuth client settings

'users, pledges-to-me'

Instance Method Summary collapse

Instance Method Details

#authorize_paramsObject



75
76
77
78
79
80
81
82
83
# File 'lib/j1_app/omniauth/strategies/patreon.rb', line 75

def authorize_params
  super.tap do |params|
    options[:authorize_options].each do |k|
      params[k] = request.params[k.to_s] unless [nil, ''].include?(request.params[k.to_s])
    end
    params[:scope] = get_scope(params)
    session['omniauth.state'] = params[:state] if params[:state]
  end
end

#callback_urlObject



43
44
45
# File 'lib/j1_app/omniauth/strategies/patreon.rb', line 43

def callback_url
  options[:redirect_uri] || full_host + script_name + callback_path
end

#raw_infoObject



91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/j1_app/omniauth/strategies/patreon.rb', line 91

def raw_info
  @raw_info ||= begin
    response = client.request(
        :get, 'https://api.patreon.com/oauth2/api/current_user',
        headers: {
            'Authorization' => "Bearer #{access_token.token}"
        },
        parse: :json
    )
    response.parsed
  end
end