> Godmode v0.19.2 documentation · Reviewed 2026-11-17
> Source: https://godmode.build/docs/v0.19.2/credentials

# Credentials and native logins

Save a provider key once, then give it to the commands that need it. Godmode stores keys locally; provider tools handle sign-in, account selection, and token refresh.

## Keep a working login

If the provider's official tool is already signed in to the right account, keep that login. An environment variable can override a saved login, so confirm the account and resource after choosing how to supply credentials.

## Save a key

Saving a key locally keeps it out of chat and source code.

```sh
godmode set GH_TOKEN
godmode list
```

`set` hides entry and previews the destination before saving. `list` shows names only. Never put a secret in a command argument.

These commands use the active key environment. Run `godmode active` to check it; use **Active setup** to switch, or `--env NAME` before a command for an explicit choice. Named environments are complete separate files and never borrow a missing key from the default file.

For provider-specific instructions, run `godmode provider github`; `godmode setup github` opens its key prompts. Replace `github` with a [provider slug](/docs/v0.19.2/providers). A saved key still needs the right permissions and a working provider account.

## Give a key to a command

Give a key only to a trusted command that needs that account. For GitHub CLI:

```sh
godmode run GH_TOKEN -- gh repo list
```

Godmode adds only the named stored keys. The command also receives variables already set in your shell and can read or transmit them. Missing or unreadable keys stop the command from starting; otherwise Godmode returns its exit status.

If the tool expects a different variable name, use an alias:

```sh
godmode run STRIPE_API_KEY=STRIPE_TEST_SECRET_KEY \
  -- stripe balance retrieve
```

This Stripe CLI read supplies the saved test key under `STRIPE_API_KEY`. It does not rename or copy the stored key.

Use trusted commands. Avoid shell tracing and diagnostics that print the environment. Use `godmode run` to supply credentials rather than reading `.env.godmode` or `seal.key`.

## Import JSON

Some provider tools use a credential file instead of a single key. Names ending in `_JSON` hold that JSON object:

```sh
godmode set ACME_AUTH_JSON --stdin < /private/path/credential.json
```

Replace the example name and path with those your tool needs. Godmode checks JSON syntax and compacts it to one line. Bundled Google service-account entries also validate the expected key format.

| Credential | What it supplies |
| --- | --- |
| API key or token | Direct access until expiry, revocation, or rotation |
| Service-account key JSON | Credentials for a provider library to obtain tokens |
| User OAuth refresh grant | Credentials for a compatible client to renew user tokens |
| OAuth client JSON | Application identity during sign-in, without a saved user login |
| Permission policy JSON | Access rules; it cannot authenticate |

Your tool must parse the JSON or use its supported private-file mechanism. `GOOGLE_APPLICATION_CREDENTIALS` expects a file path. See the [Google guide](/docs/v0.19.2/provider-google).

Import leaves the source file in place. Keep it out of Git; remove an unneeded download after confirming no tool uses it. `--stdin` saves input without interactive paste transformations.

## Replace or refresh a credential

Provider libraries renew short-lived tokens. Godmode has no background refresh service, and `run` never saves refreshed credentials. Let one provider tool own and save refreshed credentials. Save a replacement with `godmode set NAME --stdin` when it belongs in Godmode.

Before replacing a key, check the account, permissions, API, resource, and provider status. If the credential is rejected, follow the official recovery flow, save its replacement under the same name, and verify the intended operation. Update other computers and deployments separately.
