Linking a LINE Official Account with your LINE Login channel

By linking your LINE Official Account with your LINE Login channel, you can display an option to add the LINE Official Account as a friend when a user logs in to your web app.

If the user selects the Add friend button, the LINE Official Account will be added as a friend.

Consent screen

For more information on creating a bot that works as a LINE Official Account, see Messaging API.

Before you begin

To display the option to add your LINE Official Account as a friend, make sure you have the following:

  • LINE Login v2.1 or above
  • A LINE Official Account selected in the "Linked OA" item

Displaying the option to add your LINE Official Account as friend

To link a LINE Official Account with your channel, link the LINE Official Account with your channel on the console and redirect the user to the authorization URL with the bot_prompt query parameter.

Link a LINE Official Account with your LINE Login channel on the console.

To link a LINE Official Account to your LINE Login channel, you must satisfy these requirements:

  • The Messaging API channel for the LINE Official Account belongs to the same provider as your LINE Login channel.
  • You have an Admin role for both the LINE Login channel and the LINE Official Account.

    Find your role for the channel in the LINE Developers console. Find your role for the LINE Official Account in LINE Official Account Manager.

  1. Log in to the LINE Developers console and go to the provider containing the LINE Login channel.

  2. Open your LINE Login channel settings.

  3. On the LINE Login tab, under Linked OA, click Edit.

  4. Select the LINE Official Account you want users to add and click Update.

    You can select a LINE Official Account for which you have an Admin role.

    You can link only one LINE Official Account to a channel.

Redirect users to the authorization URL

Redirect users to the LINE Login authorization URL with the bot_prompt query parameter as shown below. For more information on redirecting users to the authorization URL, see Making an authorization request.

https://access.line.me/oauth2/v2.1/authorize?response_type=code&client_id={CHANNEL_ID}&redirect_uri={CALLBACK_URL}&state={STATE}&bot_prompt={BOT_PROMPT}&scope={SCOPE_LIST}


Set one of the following values for the bot_prompt query parameter.

Value Description
normal Includes an option to add a LINE Official Account as friend in the consent screen.
aggressive Opens a new screen to add the LINE Official Account as a friend after the user agrees to the permissions in the consent screen.

The following screens are displayed depending on the bot_prompt value.

Screen to be displayed

The following describes the consent screen and how the process is handled depending on the user's friendship status with the LINE Official Account before logging in.

Friendship status before login Description
Not a friend A button is displayed to add the LINE Official Account as a friend. The LINE Official Account is added as a friend if the user taps the button.
Blocked by user A button is displayed to unblock the LINE Official Account. The LINE Official Account is unblocked if the user taps the button.
Added as friend Shows that the user has added the LINE Official Account as a friend. No button is displayed to add the LINE Official Account as a friend.

Getting the friendship status of the user and the LINE Official Account

You can get the friendship status of the user and the LINE Official Account using the following methods.

Use the friendship_status_changed query parameter

If the following conditions are met, the friendship_status_changed query parameter is returned in the callback URL after the authentication and authorization process is complete.

  • The bot_prompt query parameter is specified when making an authorization request.
  • The consent screen with the option to add your LINE Official Account as a friend is displayed to the user.

The following is an example response with the friendship_status_changed parameter in the callback URL.

HTTP/1.1 302 Found
Location : https://client.example.org/cb?code={CODE}&state={STATE}&friendship_status_changed={FRIENDSHIP_STATUS_CHANGED}

The friendship_status_changed query parameter can take the following values. For more information on the callback URL, see Receiving the authorization code.

Value Description
true The friendship status of the user and the LINE Official Account changed during login. This occurs in the following situations:
  • User added the LINE Official Account as a friend
  • User unblocked the LINE Official Account
false The friendship status of the user and the LINE Official Account did not change during login. This occurs in the following situations:
  • User already added the LINE Official Account as a friend
  • User did not add the LINE Official Account as a friend
  • User did not unblock the LINE Official Account

Use the Social API to get friendship status

Send a GET request to the https://api.line.me/friendship/v1/status endpoint after the user has logged in to your app and an access token has been returned.

curl -X GET \
-H 'Authorization: Bearer {access token}' \
https://api.line.me/friendship/v1/status

The friendFlag property is returned if the API call is successful. The value is true if the user has added the LINE Official Account as a friend and has not blocked the LINE Official Account. Otherwise, the value is false.

For more information, see Get friendship status in the Social API reference.

{{ $t("form.question.helpful") }}

{{ $t("form.question.detail") }}

{{ $t("form.question.improve") }}

{{ $t("form.info.start") }}{{ $t("form.info.link") }}{{ $t("form.info.end") }}


{{ $t("form.result.success") }}
{{ $t("form.result.error") }}
{{ $t("form.result.errorLink") }}