Transfer session details to back-end server

This page explains how to securely transfer login session details to a back-end server from a native app that implements LINE Login using the LINE SDK.

Find implementation examples in the documentation for LINE SDK for iOS Swift and LINE SDK for Android.

Establish login session in native app

Native app side

After establishing a login session in the native app, get an access token from the LINE Platform and send it to the back-end server.

  1. Execute login in the native app and establish a login session.

  2. Use the LINE SDK to get the logged-in user's access token from the LINE Platform.

  3. Send the access token to the back-end server.

Transfer login session to back-end server

Backend server side

Verify that the access token received by the back-end server is correct.

  1. Receive the access token from the native app.

  2. Verify the access token.

    If verification is successful, the response contains a client_id property (channel ID) and an expires_in property (time until token expires).

  3. Check that client_id andexpires_in meet these conditions:

    Property Criteria
    client_id Same as the channel ID of the LINE Login channel linked to the native app
    expires_in Positive value

    If these conditions are met, you received a usable access token from the native app. Use this access token to call the Social API to get the correct user ID.

    Learn how to get the user ID from Get user profile.

note Only use verified tokens

If the access token you received can't be verified, don't use that access token.

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

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

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

{{ $t("") }}{{ $t("") }}{{ $t("") }}

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