The CLI couldn't securely store your login credentials in a local keychain

I am getting an error while logging in to Forge. Please help. I am new to Forge:

Error: The CLI couldn’t securely store your login credentials in a local keychain. If a local keychain is not available, use environment variables before trying again. See https://go.atlassian.com/dac/platform/forge/getting-started/#log-in-with-an-atlassian-api-token for more.

Hi,

This error means the Forge CLI couldn’t store your credentials in the OS keychain.

You don’t need forge login in that case. Set these env vars and use Forge commands directly:

export FORGE_EMAIL="your-atlassian-email"

export FORGE_API_TOKEN="your-api-token"

Create the token here (API token with scopes → select Forge):

https://id.atlassian.com/manage-profile/security/api-tokens

Then try e.g. forge whoami to confirm it works.

Docs: https://developer.atlassian.com/platform/forge/getting-started/#using-environment-variables-to-login

If you share your OS (macOS / Windows / Linux), we can also check why keychain access failed.

The recent changes to NPM’s build script security create a new pitfall with the Forge CLI. The CLI’s local keychain authentication uses the keytar dependency, which in turn requires that its own build scripts run in order to function correctly (or at least it does on Mac).

If build scripts are blocked, your login data will never be persisted and you will not be able to save your authentication with forge login.

The least-unsafe way to fix this seems to be the following:

# Edit ~/.npmrc to set ignore-scripts=false (or add this line, if it does not exist)

cd "$(npm root -g)/@forge/cli/node_modules/keytar"
npm rebuild

# Restore .npmrc ignore-scripts setting

Thanks for raising, I have sent this thread to the CLI team to investigate further.

Issue resolved.