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