1. Documents
  2. Web API

Logging out users

You can enable logout on your app by invalidating the access token through the Social REST API. To provide a better user experience, we recommend providing a way for users to log out of your app.

Before you begin

To call the Social REST API, you must have a refresh token retrieved through the LINE Login authentication and authorization process. For more information on how to use LINE Login, see the following pages.

Logging out users

To log out users, make an HTTP POST request to the https://api.line.me/v2/oauth/revoke endpoint with a refresh token in the body. This request invalidates the user’s access token and logs out the user. All user data stored on your app should be deleted when a user’s access token is invalidated.

POST https://api.line.me/v2/oauth/revoke

Request header

Header Description
Content-Type application/x-www-form-urlencoded

Request body

Parameter Description
refresh_token Refresh token string

Example request

curl -X POST \
-H 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'refresh_token={REFRESH_TOKEN}' \
https://api.line.me/v2/oauth/revoke

Response

If the call is successful, a 200 OK HTTP status code and an empty JSON object are returned.

Handling errors

The following HTTP status codes are returned when an API is called.

Status code Description
200 OK Request successful
400 Bad Request Problem with the request. Check the request parameters and JSON format.
401 Unauthorized Check that the authorization header is correct.
403 Forbidden Not authorized to use the API. Confirm that your account or plan is authorized to use the API.
429 Too Many Requests Make sure that you are within the rate limits for requests.
500 Internal Server Error Temporary error on the API server.

Related pages

For more information on the Social REST API, see the following pages.