# Attach Module Channel
The functions described in this document are available only to corporate customers who have made the prescribed applications. If you would like to publish the extension function using the module, contact the sales representative or contact us from LINE Marketplace Inquiry (opens new window) (only available in Japanese).
To use the module channel feature, you need authorization from the admin of the LINE Official Account and connect (attach) the module channel by following these steps:
# Attach module channels using the OAuth 2.0 authorization mechanism
Following the flow of the OAuth 2.0 authorization mechanism, you can attach the module channel by getting authorization from the admin of the LINE Official Account.
# Flow for attaching the module
The first screen and the fifth screen should be prepared by the company in charge of developing the module channel.
Only one module channel with the "Default Active" feature can be attached to a single LINE Official Account.
- Request authorization from the LINE Official Account admin
- About the linkage screen
- Receive the authorization code or error response
- Attach by operation of the module channel provider
# 1. Request authorization from the LINE Official Account admin
By having the admin of the LINE Official Account access the URL for authentication and authorization (authorization URL https://manager.line.biz/module/auth/v1/authorize
with query parameters), the process of attaching the module channel to the LINE Official Account will begin.
Example URL for authentication and authorization
https://manager.line.biz/module/auth/v1/authorize?response_type=code&client_id=1234567890&redirect_uri=https%3A%2F%2Fexample.com%2Fcallback&scope=message%3Asend%20message%3Areceive&state={CSRF token}®ion=JP&basic_search_id={LINE Official Account basic ID}&brand_type=premium
Generally, you'll set a link to access this URL on the page to start linking module channels, and then ask the LINE Official Account admin to click the link. In the flow in the above example, the URL can be accessed when you click Attach Module button on the "'In Your Service" Click to Attach page.
# Query Parameters
response_type
String
code
redirect_uri
String
Redirect URL. The URL for the module channel developer to receive the authorization code. After authentication and authorization (operation on the link screen), the LINE Official Account admin will be redirected to this URL.
This URL should be provided by the module channel developer. This URL must match the redirect URL that you previously registered for the module channel in the LINE Developers Console.
If you forget the URL encoding of the query parameters, the second and subsequent query parameters will be recognized as query parameters for the authentication URL and won't be passed to the redirect destination.
Example of specifying https://example.com/auth?param1=value1¶m2=value2
as the redirect_uri
in the authentication URL is https://manager.line.biz/module/auth/v1/authorize?response_type=code&client_id=1234567890&redirect_uri=https%3A%2F%2Fexample.com%2Fauth%3Fparam1%3Dvalue1%26param2%3Dvalue2&scope=message%3Asend%20message%3Areceive&state={CSRF token}®ion=JP&basic_search_id={LINE Official Account basic id}&brand_type=premium
.
client_id
String
The channel ID of the module channel. A channel-specific identifier issued by LINE.
scope
String
Specify at permission (scope) that you want to request the LINE Official Account admin to allow. To specify multiple scopes, separate them with a URL-encoded space (%20). For more information, see scopes.
state
String
A unique alphanumerical string to prevent cross-site request forgery (CSRF) (opens new window). This value should be unique string randomly generated in the system of the company responsible for the development of the module channel. URL-encoded strings can't be used.
region
String
The region of the LINE Official Account to which the module channel is attached. Specify JP
or TW
.
basic_search_id
String
LINE Official Account basic ID (opens new window). Specify when you want to allow the module channel to be attached only to specific LINE Official Accounts.
brand_type
String
Specify to limit the account types of LINE Official Accounts (opens new window) that can be attached.
- Premium Account:
premium
- Verified Account:
verified
- Unverified Account:
unverified
To specify multiple account types, concatenate a URL-encoded space (%20). For example, to limit the attachment of only premium accounts and authenticated accounts, you would specify brand_type=premium%20verified
.
code_challenge
String
Specify when using PKCE (Proof Key for Code Exchange) defined in the OAuth 2.0 extension specification as a countermeasure against authorization code interception attacks. Compliant with RFC 7636 (opens new window).
code_challenge_method
String
S256
Specify when using PKCE (Proof Key for Code Exchange) defined in the OAuth 2.0 extension specification as a countermeasure against authorization code interception attacks. Compliant with RFC 7636 (opens new window).
# Scopes
You can specify the following scopes with the scope
parameter. To specify multiple scopes, separate them with a URL-encoded space (%20).
* The Chat Plugin function is currently only available to select corporate users.
# 2. About the linkage screen
When the admin of the LINE Official Account accesses the URL for authentication and authorization, the LINE Official Account Manager linkage screen will be displayed. The linkage screen shows what you applied for when creating a module channel. You can check the settings in the LINE Developers Console.
# 3. Receive the authorization code or error response
When the admin of the LINE Official Account completes authentication and authorization, the authorization code and error code are passed to the redirect URL (redirect_uri
) specified in the URL for authentication and authorization through these query parameters. In the flow presented in the above example, the authorization code and error code are passed when the Link button is clicked on the "OAM Confirm and Attach" screen.
# Receiving the authorization code
Once the admin of the LINE Official Account has been authenticated and has completed the authorization, they are redirected to the redirect URL (redirect_uri
) with these query parameters.
# Query Parameters
code
String
This is the authorization code required to link (attach) to the LINE Official Account. This authorization code has an expiration date and can be used only once.
state
String
Anti-CSRF string. Make sure this string is the same as specified in the state
query parameter of the URL for authentication and authorization.
# Receiving an error response
If authentication by the admin of the LINE Official Account fails, you'll be redirected to the redirect URL (redirect_uri
) with these query parameters.
# Query Parameters
error
String
Error code.
error_description
String
Error details.
state
String
Anti-CSRF string. Make sure this string is the same as specified in the state
query parameter of the URL for authentication and authorization.
# 4. Attach by operation of the module channel provider
Once you get the authorization code and confirm that the string passed in the state
query parameter is okay, attach the module channel to the LINE Official Account.
For more information, see Attach by operation of the module channel provider in the Option API reference for corporate customers.