LINE.Bot.ChannelAccessToken (line_bot_sdk v0.2.0)

Copy Markdown

API calls for all endpoints tagged ChannelAccessToken.

Summary

Functions

Issues a channel access token that allows you to specify a desired expiration date. This method lets you use JWT assertion for authentication.

Issues a new stateless channel access token, which doesn't have max active token limit unlike the other token types. The newly issued token is only valid for 15 minutes but can not be revoked until it naturally expires.

Create a new ChannelAccessToken client.

Revoke short-lived or long-lived channel access token

Verify the validity of short-lived and long-lived channel access tokens

You can verify whether a Channel access token with a user-specified expiration (Channel Access Token v2.1) is valid.

Functions

gets_all_valid_channel_access_token_key_ids(client, client_assertion_type, client_assertion, client_opts \\ [])

Gets all valid channel access token key IDs.

Parameters

  • client (Req.Request.t/0): Client to make request with
  • client_assertion_type (String.t/0): urn:ietf:params:oauth:client-assertion-type:jwt-bearer
  • client_assertion (String.t/0): A JSON Web Token (JWT) (opens new window)the client needs to create and sign with the private key.
  • client_opts (keyword/0): Options to pass to Req.request

Returns

  • {:ok, LINE.Bot.Model.ChannelAccessTokenKeyIdsResponse.t} on success
  • {:error, Req.Response.t} on failure

issue_channel_token(client, grant_type, client_id, client_secret, client_opts \\ [])

Issue short-lived channel access token

Parameters

Returns

  • {:ok, LINE.Bot.Model.IssueShortLivedChannelAccessTokenResponse.t} on success
  • {:error, Req.Response.t} on failure

issue_channel_token_by_jwt(client, grant_type, client_assertion_type, client_assertion, client_opts \\ [])

Issues a channel access token that allows you to specify a desired expiration date. This method lets you use JWT assertion for authentication.

Parameters

  • client (Req.Request.t/0): Client to make request with
  • grant_type (String.t/0): client_credentials
  • client_assertion_type (String.t/0): urn:ietf:params:oauth:client-assertion-type:jwt-bearer
  • client_assertion (String.t/0): A JSON Web Token the client needs to create and sign with the private key of the Assertion Signing Key.
  • client_opts (keyword/0): Options to pass to Req.request

Returns

  • {:ok, LINE.Bot.Model.IssueChannelAccessTokenResponse.t} on success
  • {:error, Req.Response.t} on failure

issue_stateless_channel_token(client, optional_args \\ [], client_opts \\ [])

Issues a new stateless channel access token, which doesn't have max active token limit unlike the other token types. The newly issued token is only valid for 15 minutes but can not be revoked until it naturally expires.

Parameters

  • client (Req.Request.t/0): Client to make request with
  • optional_args (keyword): Optional parameters
    • :grant_type (String.t/0): client_credentials
    • :client_assertion_type (String.t/0): URL-encoded value of urn:ietf:params:oauth:client-assertion-type:jwt-bearer
    • :client_assertion (String.t/0): A JSON Web Token the client needs to create and sign with the private key of the Assertion Signing Key.
    • :client_id (String.t/0): Channel ID.
    • :client_secret (String.t/0): Channel secret.
  • client_opts (keyword/0): Options to pass to Req.request

Returns

  • {:ok, LINE.Bot.Model.IssueStatelessChannelAccessTokenResponse.t} on success
  • {:error, Req.Response.t} on failure

new(options \\ [])

Create a new ChannelAccessToken client.

Options

  • :base_url - base URL for requests (default: "https://api.line.me")
  • :plug - plug to use for testing (see Req.new/1)

revoke_channel_token(client, access_token, client_opts \\ [])

Revoke short-lived or long-lived channel access token

Parameters

  • client (Req.Request.t/0): Client to make request with
  • access_token (String.t/0): A short-lived or long-lived channel access token.
  • client_opts (keyword/0): Options to pass to Req.request

Returns

  • {:ok, nil} on success
  • {:error, Req.Response.t} on failure

revoke_channel_token_by_jwt(client, client_id, client_secret, access_token, client_opts \\ [])

Revoke channel access token v2.1

Parameters

Returns

  • {:ok, nil} on success
  • {:error, Req.Response.t} on failure

verify_channel_token(client, access_token, client_opts \\ [])

Verify the validity of short-lived and long-lived channel access tokens

Parameters

  • client (Req.Request.t/0): Client to make request with
  • access_token (String.t/0): A short-lived or long-lived channel access token.
  • client_opts (keyword/0): Options to pass to Req.request

Returns

  • {:ok, LINE.Bot.Model.VerifyChannelAccessTokenResponse.t} on success
  • {:error, Req.Response.t} on failure

verify_channel_token_by_jwt(client, access_token, client_opts \\ [])

You can verify whether a Channel access token with a user-specified expiration (Channel Access Token v2.1) is valid.

Parameters

  • client (Req.Request.t/0): Client to make request with
  • access_token (String.t/0): Channel access token with a user-specified expiration (Channel Access Token v2.1).
  • client_opts (keyword/0): Options to pass to Req.request

Returns

  • {:ok, LINE.Bot.Model.VerifyChannelAccessTokenResponse.t} on success
  • {:error, Req.Response.t} on failure