module BacklogKit::Client::Authorization

Methods for OAuth 2.0 authorization

@see developer.nulab-inc.com/docs/backlog/auth

Public Instance Methods

create_token(oauth_code) click to toggle source

Create a new access token

@param oauth_code [String] Authorization code that you get from the authorization endpoint @return [BacklogKit::Response] The token information

# File lib/backlog_kit/client/authorization.rb, line 11
def create_token(oauth_code)
  params = {
    client_id: client_id,
    client_secret: client_secret,
    grant_type: 'authorization_code',
    code: oauth_code
  }
  params[:redirect_uri] = redirect_uri if redirect_uri
  request(:post, 'oauth2/token', params, true)
end
update_token() click to toggle source

Refresh an access token

@return [BacklogKit::Response] The token information

# File lib/backlog_kit/client/authorization.rb, line 25
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