Module: LinkedIn::API::Authentication

Defined in:
lib/linkedin/api/authentication.rb

Instance Method Summary collapse

Instance Method Details

#authorize_url(**params) ⇒ Object



4
5
6
7
8
# File 'lib/linkedin/api/authentication.rb', line 4

def authorize_url(**params)
  params.reverse_merge! configuration.to_h.slice :scope, :state, :redirect_uri
  params[:scope] = serialize_scope params[:scope]
  credentials.auth_code.authorize_url params
end

#request_access_token(authorization_code, params = {}) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/linkedin/api/authentication.rb', line 10

def request_access_token(authorization_code, params = {})
  raise Error::CSRF.new state, params[:state] if params[:state] && params[:state] != state

  params.reverse_merge! redirect_uri: configuration.redirect_uri
  opts = { mode: :query, param_name: 'oauth2_access_token' }

  credentials.auth_code.get_token authorization_code, params, opts
end