# Logging out users

You can enable logout on your app by invalidating the access token through the Social 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 API, you must have an access 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/oauth2/v2.1/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/oauth2/v2.1/revoke

# Request header

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

# Request body

Property Type Required Description
access_token String Required Access token
client_id String Required Channel ID. Found on the LINE Developers Console.
client_secret String Required Channel secret. Found on the LINE Developers Console.

Example request

curl -v -X POST https://api.line.me/oauth2/v2.1/revoke \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "client_id={channel id}&client_secret={channel secret}&access_token={access token}"

# Response

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

# Status codes

The following HTTP status codes are returned when an HTTP request is sent.

HTTP status 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 limit for requests.
500 Internal Server Error Temporary error on the API server.

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