# Sign in to the CLI

Source: https://docs.graphops.xyz/platform/cli/sign-in

Use the GraphOps CLI with your own account without copying passwords or tokens into a terminal.
The CLI shows a short code. You approve it in a browser where you can use your usual sign-in
methods, and the CLI finishes signing in on its own. To install the CLI, see
[GraphOps CLI](/platform/cli).

## Sign in

1. Run `graphops auth login`. The CLI shows a sign-in address and a code.
2. Open the address in a browser and enter the code exactly as the CLI shows it.
3. Sign in with your password or a passkey, and complete two-factor authentication if your sign-in
requires it. You can also choose Google or GitHub when that provider is already connected to
your GraphOps account.
4. Check that the code on the approval page matches the code in your terminal and that the page
shows the account the CLI should use, then choose **Allow**. To use a different account, choose
**Use another account** and sign in again.

The CLI finishes signing in after you allow the request, and the browser tells you to return to
your terminal. If the code expires before you approve it, run `graphops auth login` again to get a
new code.

Approving always asks you to sign in, even when the browser is already signed in to GraphOps.
The approval signs in only the CLI. It does not sign that browser in to the platform. Your
account's email address must be verified before you can approve the CLI.

> **Approve only your own codes**
>
> Approving a code gives the CLI that requested it access to your account. Enter only codes that you
> started from your own terminal, and choose **Deny** if you did not run `graphops auth login` or
> the codes do not match.

## What you approve

Allowing the request lets the GraphOps CLI:

* Read your name and email address.
* Send requests as your account, with the role you have in each of your organizations.
* Stay signed in without asking you again, until its session ends.

The CLI does not receive your password, passkey, or two-factor codes. Approval never creates an
account or connects a provider: to approve with Google or GitHub,
[connect the provider](/platform/account-and-security#connect-google-or-github) from
**Account** first. If you choose a Google or GitHub account that isn't
connected to GraphOps, the browser stops and the request stays unapproved. Connect the provider,
then run `graphops auth login` again.

## How long the CLI stays signed in

Each approval creates a CLI session that lasts for a limited period. When it
ends, the CLI can no longer send requests. Run `graphops auth login` to sign in again. To sign the
CLI out before then, [end its session](#end-a-cli-session): the CLI is signed out immediately.

A command that makes a person-only change, such as creating a key, also needs a recent sign-in. When the CLI asks you to sign in again, run
`graphops auth login`, then run the command again. See [Sign in again for sensitive changes](/platform/account-and-security#sign-in-again-for-sensitive-changes).

## Use the CLI from CI or a server

Automation does not sign in as a person. Give it a
[service account](/platform/service-accounts) instead, and set the `GRAPHOPS_TOKEN` environment
variable to one of the account's service account API keys, stored as a secret of your CI system or
server. The CLI then acts as the service account, with its permissions. Commands that act as
you, such as `graphops auth login`, do not work with a service account.

## End a CLI session

End a CLI session when you no longer use the CLI on that computer, or when you do not recognize
it. In **Account**, find the session under
**Sessions**. CLI sessions show **GraphOps CLI** with the
**CLI** label.

Open the session's action menu, choose **End session**, and confirm. The CLI's
next request is refused, including after it refreshes its sign-in, and it must sign in again.
Ending a CLI session does not sign out your browser sessions. See
[end a device session](/platform/account-and-security#end-a-device-session) for the other session
controls.

## Next steps

* [GraphOps CLI](/platform/cli): Install the CLI and check your setup.
* [Account](/platform/account-and-security): Manage the sign-in methods you use to approve the CLI.
* [Support and status](/platform/support-and-status): Get help with an account or access issue.