Module: BacklogKit::Client::Authorization
- Included in:
- BacklogKit::Client
- Defined in:
- lib/backlog_kit/client/authorization.rb
Overview
Methods for OAuth 2.0 authorization
Instance Method Summary collapse
-
#create_token(oauth_code) ⇒ BacklogKit::Response
Create a new access token.
-
#update_token ⇒ BacklogKit::Response
Refresh an access token.
Instance Method Details
#create_token(oauth_code) ⇒ BacklogKit::Response
Create a new access token
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/backlog_kit/client/authorization.rb', line 13 def create_token(oauth_code) params = { client_id: client_id, client_secret: client_secret, grant_type: 'authorization_code', code: oauth_code } params.merge!(redirect_uri: redirect_uri) if redirect_uri request(:post, 'oauth2/token', params, true) end |
#update_token ⇒ BacklogKit::Response
Refresh an access token
27 28 29 30 31 32 33 34 35 |
# File 'lib/backlog_kit/client/authorization.rb', line 27 def update_token params = { client_id: client_id, client_secret: client_secret, grant_type: 'refresh_token', refresh_token: refresh_token } request(:post, 'oauth2/token', params, true) end |