Class: Lyft::Client::Api::Oauth

Inherits:
Base
  • Object
show all
Defined in:
lib/lyft/client/api/oauth.rb,
lib/lyft/client/api/oauth/scope.rb,
lib/lyft/client/api/oauth/grant_type.rb

Overview

Client for making authentication related requests to the lyft api

Defined Under Namespace

Classes: GrantType, Scope

Instance Attribute Summary

Attributes inherited from Base

#configuration

Instance Method Summary collapse

Methods inherited from Base

#connection, #initialize

Constructor Details

This class inherits a constructor from Lyft::Client::Api::Base

Instance Method Details

#retrieve_access_token(authorization_code: nil, scope: Scope::PUBLIC) ⇒ HTTParty::Response

Retrieves access token from the server.

Examples:

Get public access token.

resp = client.authentication.retrieve_access_token
resp.success?

Get access token from authorization_code.

resp = client.authentication.retrieve_access_token authorization_code: 'auth_code'
resp.success?

Parameters:

  • authorization_code (String) (defaults to: nil)
  • scope (String) (defaults to: Scope::PUBLIC)

Returns:

  • (HTTParty::Response)


24
25
26
27
28
# File 'lib/lyft/client/api/oauth.rb', line 24

def retrieve_access_token(authorization_code: nil, scope: Scope::PUBLIC)
  body = build_auth_body(authorization_code, scope)
  resp = connection.post '/oauth/token', body
  handle_response(resp)
end