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.
Sign in
- Run
graphops auth login. The CLI shows a sign-in address and a code. - Open the address in a browser and enter the code exactly as the CLI shows it.
- 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.
- 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.
graphops auth status shows who is signed in and in which organization, and tells you when the
session has expired. graphops auth status --check exits 3 unless GraphOps accepts the session or
token, so a script can check before it starts.
Choose an organization
Commands act in the organization you chose, with your role in it. graphops orgs list lists the
organizations you belong to, and graphops orgs use <organization> selects one by its slug or ID.
To use another organization for one command, pass --organization with its slug or ID.
graphops orgs use changes the organization for every terminal that uses the same profile, so each
command that changes something names the organization it acted in, such as in Acme (acme). Each
organization also has its own stored API key, so switching organization switches the key that
graphops exec uses.
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 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: 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.
Use the CLI from CI or a server
Automation does not sign in as a person. Give it a
service account 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. See
Run the CLI in CI.
Where the session is kept
The CLI keeps your session in your operating system's credential store: the macOS Keychain, the
Secret Service on Linux, or Windows Credential Manager. graphops auth status names the store it
uses. Where the key is kept explains the
file the CLI uses where no credential store is available. graphops auth logout removes the
session from this computer.
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 for the other session controls.
Next steps
Last updated
Developer workflow
Store your GraphOps API key in the macOS Keychain or Linux Secret Service, check which key is in use, and call RPC, Subgraphs and Substreams with it from your terminal and your own code.
Manage keys and service accounts
Create, change, rotate and revoke API keys and service accounts from the GraphOps CLI, and replace a key without downtime.