# Account and session


## Storage and sign-out

The CLI keeps one LINE account per operating-system user:

| System | Where the session is stored |
| --- | --- |
| macOS | Keychain. |
| Linux | An encrypted session file whose key is in Secret Service. |
| Windows | An encrypted session file protected with your Windows account (DPAPI). |

Your password is used only to sign in and is never saved. Commands lock the
session while they update it; if a command reports that the session is busy,
try again once the other command finishes.

### Check local storage

```sh
line auth status
line auth status --check --json
```

`auth status` checks whether local storage can be read. It doesn't contact
LINE, refresh a token, or prove that the saved login still works. Storage that
can't be read is reported as unreadable, not as signed out.

`--check` also tests whether storage can be written, where it can do that
without an unlock prompt. macOS Keychain and Linux Secret Service may report
`interactive_check_required`; their full write check runs during interactive
login. Headless access after a reboot stays `expected_not_verified` until you
test it on your machine.

### Sign out

```sh
line logout
line logout --local-only
```

`line logout` revokes this device's session on LINE's servers (with
`--timeout`, default `15s`) and then deletes your saved credentials. It doesn't
sign out your phone or other devices, and your LINE account stays active. If
LINE says the session is already signed out, local credentials are still
removed. If revoking fails, for example while offline, your local credentials
are kept; try again when online, or use `--local-only` to delete them without
contacting LINE.

## Token refresh

LINE decides when an access token must be refreshed. That can be a few days
after login, so don't plan around a fixed lifetime. While the saved refresh
token works, the CLI renews access automatically, even after a restart. If LINE
rejects the refresh, commands say so and ask you to run `line login` (JSON code
`authentication_failed`); trying again later won't help. A missing refresh token
also needs `line login`.

Read-only requests may refresh credentials and retry once. Sends, reactions,
unsend, and uploads are never repeated automatically; check LINE before
repeating an action whose result is uncertain. The watcher reconnects with your
saved credentials when needed.

Only an explicit sign-out signal from LINE's servers invalidates the saved
session. Token expiry, a generic HTTP 401 or 403, a rejected refresh, or a
network failure alone don't. A sign-out signal doesn't necessarily tell you
whether another client replaced the session. If storage fails after a token
change, further requests stop, because the CLI can't be sure the new token was
saved.

For refresh timing, retry rules, and the evidence behind them, see the
[token and session audit](https://github.com/kongesque/line-cli/blob/main/docs/SESSION.md#token-refresh).


---
Source: https://kongesque.github.io/line-cli/guides/account/
