Module: LinkedIn::API::Authentication

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#stateObject (readonly)

Returns the value of attribute state.



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

def state
  @state
end

Instance Method Details

#authorize_url(params = {}) ⇒ Object



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

def authorize_url(params={})
  params.reverse_merge! defaults(:scope, :state, :redirect_uri)
  auth_code.authorize_url params
end

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



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

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

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

  self.access_token = auth_code.get_token authorization_code, params, opts
end