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

# Credentials and native logins

Use your provider's own login when it already works, or save a key in Godmode and pass it to a specific command.

## Keep a working login

If the official provider tool is signed in to the right account, use that login. Environment variables can override the tool's saved credentials. Check which account and resource the tool can read before making changes.

## Save a key

Open a masked prompt for one key, then confirm that its name is listed:

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

In the native prompt, review the masked edit before pressing Enter. In `--plain` mode, press Enter to review and again to save. Never paste keys into chat or give them as command arguments.

Run `godmode active` to check the selected environment. Use an explicit `--env NAME` or [Switch setup](/docs/contexts) to choose a different one. For provider-specific steps, run `godmode provider github` and `godmode setup github`.

## Give a key to a command

For an installed GitHub CLI, give it `GH_TOKEN` for one read:

```sh
godmode run GH_TOKEN -- \
  gh api user --jq .login
```

When a tool expects a different environment variable, use `VAR=NAME`:

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

`VAR` is the variable the command receives. `NAME` is the saved key. A missing or unreadable key stops the command before it runs. The command inherits your existing shell environment as well, so use trusted programs and keep shell tracing and environment dumps off.

## Import JSON

Import a private credential file under a name ending in `_JSON`:

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

Godmode requires a JSON object and stores it on one line. The source file stays in place. Keep it private and out of version control.

Your program must parse the variable and pass the resulting object to its auth library, or use a supported private-file mechanism. `GOOGLE_APPLICATION_CREDENTIALS` expects a file path. Google's bundled entries accept service-account private key JSON. See the [Google provider guide](/docs/provider-google) and [Google's credential search order](https://docs.cloud.google.com/docs/authentication/application-default-credentials).

## Replace or refresh a credential

Let the provider tool own and refresh its login. If it returns a replacement grant that you keep in Godmode, save it with `godmode set NAME --stdin`. Godmode only saves credentials when you explicitly write them.

For a rejected key, check the account, permissions, API, and target first. If the key needs rotation, replace it under the same name and verify it with the provider. Update copies on other machines and deployments separately.
