> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stardeck.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Sign in with LINE

> Connect your own LINE MINI App so customers are signed in automatically inside LINE and your Official Account can message them.

By default, a customer who signs in to your app with LINE gets a LINE user ID from Stardeck's LINE provider. LINE gives each person a different ID under each provider, so your Official Account doesn't recognize that ID and can't send that customer a message.

To fix this, create a **LINE MINI App** in the same LINE provider as your Official Account and connect it to your app. Customers who open your app inside LINE are then signed in with an ID your account can message. Customers who already have an account keep it.

Setup takes one copy, one paste and one scan on your phone. You don't need to change your app.

## Before you start

* **A LINE Official Account connected to the app.** It must be the account the app sends messages from (the default one, if the app has more than one). See [Connect LINE](/connected-services/line/connecting).
* **LINE turned on as a sign-in method** for the app. See [User Authentication](/user-authentication#social-login).
* **A public app.** Internal apps and internal surfaces can't be opened in LINE. Only public ones can use a MINI App.
* **The latest platform version.** If your app is behind, the setup card asks you to update the app and deploy it to production first.
* **A country where LINE offers MINI Apps.** That's Japan, Thailand and Taiwan, and your company's country must match.
* **A custom domain, if you plan to use one.** Until LINE verifies your MINI App, customers see your app's address in its header, so a domain of your own looks better than the default one. If you change domains later, update the address in the LINE console too. See [Custom domains](/custom-domains).

## Connect your MINI App

You'll find the setup under the app's **Settings → Authentication** tab, in a card called **Open in LINE**. The card only appears when LINE is enabled as a sign-in method.

<Steps>
  <Step title="Create a MINI App channel in LINE">
    In the [LINE Developers Console](https://developers.line.biz/), open the **same provider as your
    Official Account** and create a LINE MINI App channel. LINE doesn't let a channel move to
    another provider later, so if you pick the wrong one you'll need to create a new channel.
  </Step>

  <Step title="Paste your app's address into LINE">
    Copy the **Endpoint URL** from the **Open in LINE** card. In the console, open the MINI App's
    **Web app settings** and paste it into **Published**. If your MINI App isn't verified yet, paste
    it into **Developing** too.
  </Step>

  <Step title="Set scopes and link your account">
    Set the scopes to `openid` and `profile`. Link your Official Account and turn on the add-friend
    option, so customers can add your account when they first open the app.
  </Step>

  <Step title="Paste the LIFF ID into Stardeck">
    Copy the **Published** LIFF ID from the console. It looks like `1234567890-AbCdEfGh`. Paste it
    into the card and click **Save**.
  </Step>

  <Step title="Scan the QR code on your phone">
    The card shows a QR code and a pending status. Add your Official Account as a friend on your
    phone first, then scan the code. Setup is finished when you get a **LINE sign-in connected**
    message from your account, and the status changes from **Pending** to **Live**.
  </Step>
</Steps>

If you have more than one public surface, each one has its own section in the card and needs its own MINI App.

### If it stays pending

Setup only finishes when LINE confirms that your Official Account knows the person who opened the link. These are the usual reasons it doesn't:

* You haven't added your Official Account as a friend on the phone you scanned with.
* You blocked the account on that phone.
* The MINI App sits in a different LINE provider than your Official Account. Check the provider in the console. If it's wrong, create a new MINI App channel in the right one, since channels can't move.

## Use the MINI App link in your rich menu

Once the status is **Live**, the card shows a link in the form `https://miniapp.line.me/{liffId}`. Add a path to open a specific page, for example `/account`, and copy the result into your rich menu button.

This replaces the older portal link from [User Authentication](/user-authentication#line-portal-links-rich-menu). The old link keeps working as a fallback for people on a regular browser, and the **LINE portal link** card shows it under **Browser fallback**.

The LINE button on your app's sign-in page also goes through the MINI App once it's connected.

## What customers see

* **A consent screen the first time they open it.** LINE shows this for MINI Apps that aren't verified. You can apply for verification in the LINE console.
* **They're signed in automatically** when they open your app inside LINE.
* **Existing accounts are kept.** If someone who already has an account opens the app in LINE while signed in, their LINE account is linked to it, so their bookings and history stay with them. A person with no account gets a new one.
* **An add-friend option from LINE**, since you turned it on in setup. Signing in doesn't depend on it.

A connected MINI App makes sure the ID is one your Official Account can message. It doesn't change who can receive messages: customers who haven't added your account, or who blocked it, still won't get anything you send.

## For builders

You don't write code for sign-in. In your app, `session.user.lineUserId` holds the LINE user ID from your own provider, and it's the ID your Official Account sends to. If your app needs LINE features such as closing the window or sharing, ask the agent for them and it uses the `useLiff()` hook that comes with the authentication package.

Never trust a LINE user ID that the browser sends to your backend. Anyone can fake it. Use the ID on the signed-in session instead.

Your app can tell whether the customer has added your account, so it can show a dismissible "Add us on LINE to get updates" prompt. The app doesn't show one by default. To add it, describe it in the project chat:

```
If someone opens the app in LINE and hasn't added our account yet, show a small dismissible prompt to add us
```

## Next steps

<CardGroup cols={2}>
  <Card title="Connect LINE" icon="plug" href="/connected-services/line/connecting">
    Link your Official Account and grant it to your apps
  </Card>

  <Card title="User Authentication" icon="lock" href="/user-authentication">
    Sign-in methods and LINE portal links
  </Card>
</CardGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.