Method: LineLogin::Client#issue_access_token

Defined in:
lib/line_login/client.rb

#issue_access_token(code:, redirect_uri: nil, code_verifier: nil) ⇒ Object

Issues access tokens.

The access tokens managed through the LINE Login API attest that an app has been granted permission to access user data (such as user IDs, display names, profile images, and status messages) saved on the LINE Platform.

LINE Login API calls require you to provide an access token or refresh token that was sent in an earlier response.



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/line_login/client.rb', line 47

def issue_access_token(code: , redirect_uri: nil, code_verifier: nil)
  option = {
    url: "#{api_origin}/oauth2/v2.1/token",
    header: {
      "Content-Type": "application/x-www-form-urlencoded",
    },
    param: {
      grant_type: :authorization_code,
      code: code,
      redirect_uri: redirect_uri || self.redirect_uri,
      client_id: client_id,
      client_secret: client_secret,
      code_verifier: code_verifier
    }
  }
  response = post(option)
  JSON.parse(response.body)
end