Class: YandexClient::Auth
- Inherits:
-
Object
- Object
- YandexClient::Auth
- Includes:
- Configurable, ErrorHandler
- Defined in:
- lib/yandex_client/auth.rb
Overview
tech.yandex.ru/oauth/doc/dg/reference/refresh-client-docpage/ tech.yandex.ru/oauth/doc/dg/reference/auto-code-client-docpage/#auto-code-client__get-token
Example:
token = Token.first
YandexClient.auth.create_token('9388894')
YandexClient.auth.refresh_token(token.refresh_token)
Constant Summary collapse
- ACTION_URL =
'https://oauth.yandex.ru/token'
Instance Method Summary collapse
Methods included from Configurable
Instance Method Details
#create_token(code) ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/yandex_client/auth.rb', line 20 def create_token(code) process_response with_config.post( ACTION_URL, headers: common_headers, body: URI.encode_www_form( request_body_for('authorization_code').merge!(code: code) ) ) end |
#refresh_token(refresh_token) ⇒ Object
30 31 32 33 34 35 36 37 38 |
# File 'lib/yandex_client/auth.rb', line 30 def refresh_token(refresh_token) process_response with_config.post( ACTION_URL, headers: common_headers, body: URI.encode_www_form( request_body_for('refresh_token').merge!(refresh_token: refresh_token) ) ) end |