Really struggeling to login in with the cli…
forge --version
11.2.0
forge login
... enter mail
... enter token
–>Error: The CLI couldn’t securely store your login credentials in a local keychain. Ensure you enable access to the macOS keychain when prompted. 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.
Using Env Vars doesn’t work, it just asks again for the mail and token and gives same error.
Running verbose even shows that i get user information but still asking for mail again … no additional info…
sh-3.2$ FORGE_EMAIL=s..oud FORGE_API_TOKEN=ATAT...6B forge login --verbose
▶️ GraphQL https://api.atlassian.com/graphql
Query:
query forge_cli_getUserDetails {
me {
user {
name
accountStatus
accountId
}
}
}
Variables: {}
◀️ GraphQL
Request ID: 590...d13f0
Result: {
"me": {
"user": {
"name": "Steven Hooker",
"accountStatus": "active",
"accountId": "712...65"
}
}
}
Log in to your Atlassian account
Press Ctrl+C to cancel.
? Enter your email: ()
any help is appreciated
Hi Steven, thanks for contacting us.
Please note that, as per https://go.atlassian.com/dac/platform/forge/getting-started/#log-in-with-an-atlassian-api-token (see the last blue box at the bottom), when environment variables are used, you don’t need to use forge login
.
So you can do
export FORGE_EMAIL=mymail@example.com
export FORGE_API_TOKEN=ATAT...
# no forge login needed, every 'forge' command will use these env vars as credentials
forge create
If you want to use environment variables with forge login
you can do something like, though again forge login
won’t be needed as all commands will use env vars anyway.
export FORGE_EMAIL=mymail@example.com
export FORGE_API_TOKEN=ATAT...
forge login -u $FORGE_EMAIL -t $FORGE_API_TOKEN
But please note that environment variables will override the credentials used for forge login
. For instance
export FORGE_EMAIL=mymail@example.com
export FORGE_API_TOKEN=ATAT...
forge login -u different.mail@example.com -t DIFFERENTAPITOKEN...
forge create
The last forge create
command here will use the exported env vars as credentials, not the ones used for forge login
command.
Please let us know if this solves your problem and/or if you need help with anything else.
1 Like
Thanks Mehmet. ```
forge create
works :)
Just could have saved me 3 hours, just by reading your post fully...
1 Like
“Fixed” my original issue. it was pnpm, which i used to install the forge cli… never had any similar problem wtih pnpm… Check the commands
(forge cli uses keytar under the hood) steven@Stevens-MacBook-Pro ~/keytar-test> pnpm install
Packages: +37
+++++++++++++++++++++++++++++++++++++
Progress: resolved 37, reused 37, downloaded 0, added 37, done
dependencies:
╭ Warning ───────────────────────────────────────────────────────────────────────────────────╮
│ │
│ Ignored build scripts: keytar. │
│ Run “pnpm approve-builds” to pick which dependencies should be allowed to run scripts. │
│ │
╰────────────────────────────────────────────────────────────────────────────────────────────╯
Done in 709ms using pnpm v10.11.1
steven@Stevens-MacBook-Pro ~/keytar-test> node test.jy
node:internal/modules/cjs/loader:1228
throw err;
^
Error: Cannot find module ‘../build/Release/keytar.node’
Require stack:
- /Users/steven/keytar-test/node_modules/.pnpm/keytar@7.9.0/node_modules/keytar/lib/keytar.js
- /Users/steven/keytar-test/test.jy
at Module._resolveFilename (node:internal/modules/cjs/loader:1225:15)
at Module._load (node:internal/modules/cjs/loader:1051:27)
at Module.require (node:internal/modules/cjs/loader:1311:19)
at require (node:internal/modules/helpers:179:18)
at Object. (/Users/steven/keytar-test/node_modules/.pnpm/keytar@7.9.0/node_modules/keytar/lib/keytar.js:1:14)
at Module._compile (node:internal/modules/cjs/loader:1469:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1548:10)
at Module.load (node:internal/modules/cjs/loader:1288:32)
at Module._load (node:internal/modules/cjs/loader:1104:12)
at Module.require (node:internal/modules/cjs/loader:1311:19) {
code: ‘MODULE_NOT_FOUND’,
requireStack: [
‘/Users/steven/keytar-test/node_modules/.pnpm/keytar@7.9.0/node_modules/keytar/lib/keytar.js’,
‘/Users/steven/keytar-test/test.jy’
]
}
Node.js v20.17.0
steven@Stevens-MacBook-Pro ~/keytar-test [1]> rm -rf node_modules/
steven@Stevens-MacBook-Pro ~/keytar-test> rm pnpm-lock.yaml
steven@Stevens-MacBook-Pro ~/keytar-test> npm install
added 37 packages, and audited 38 packages in 1s
9 packages are looking for funding
run npm fund
for details
found 0 vulnerabilities
steven@Stevens-MacBook-Pro ~/keytar-test> node test.jy
Retrieved from keychain: secret