Class: OmniAuth::Strategies::Pinterest
- Inherits:
-
OAuth2
- Object
- OAuth2
- OmniAuth::Strategies::Pinterest
- Defined in:
- lib/omniauth/strategies/pinterest.rb
Instance Method Summary collapse
-
#authorize_params ⇒ Object
You can pass
display,scope, orauth_typeparams to the auth request, if you need to set them dynamically. - #basic_auth_header ⇒ Object
- #build_access_token ⇒ Object
- #callback_url ⇒ Object
- #raw_info ⇒ Object
- #request_phase ⇒ Object
- #ssl? ⇒ Boolean
Instance Method Details
#authorize_params ⇒ Object
You can pass display, scope, or auth_type params to the auth request, if you need to set them dynamically. You can also set these options in the OmniAuth config :authorize_params option.
For example: /auth/pinterest?display=popup
37 38 39 40 41 42 43 44 45 |
# File 'lib/omniauth/strategies/pinterest.rb', line 37 def super.tap do |params| %w[display scope auth_type].each do |v| params[v.to_sym] = request.params[v] if request.params[v] end params[:scope] ||= DEFAULT_SCOPE end end |
#basic_auth_header ⇒ Object
56 57 58 59 60 61 62 |
# File 'lib/omniauth/strategies/pinterest.rb', line 56 def basic_auth_header auth = Base64.strict_encode64( "#{options[:client_id]}:#{options[:client_secret]}", ) "Basic #{auth}" end |
#build_access_token ⇒ Object
47 48 49 50 51 52 53 54 |
# File 'lib/omniauth/strategies/pinterest.rb', line 47 def build_access_token .token_params.merge!( headers: { 'Authorization' => basic_auth_header, }, ) super end |
#callback_url ⇒ Object
64 65 66 |
# File 'lib/omniauth/strategies/pinterest.rb', line 64 def callback_url full_host + script_name + callback_path end |
#raw_info ⇒ Object
24 25 26 27 |
# File 'lib/omniauth/strategies/pinterest.rb', line 24 def raw_info access_token.[:parse] = :json @raw_info ||= access_token.get('/v5/user_account').parsed end |
#request_phase ⇒ Object
14 15 16 17 18 |
# File 'lib/omniauth/strategies/pinterest.rb', line 14 def request_phase [:scope] ||= 'user_accounts:read' [:response_type] ||= 'code' super end |
#ssl? ⇒ Boolean
29 30 31 |
# File 'lib/omniauth/strategies/pinterest.rb', line 29 def ssl? request.scheme == 'https' end |