cli icon indicating copy to clipboard operation
cli copied to clipboard

RAILWAY_API_TOKEN getting Unauthorized. Please login with `railway login`

Open dwilt opened this issue 9 months ago • 2 comments

According to your docs, I can take an API token created in my account tokens page and prefix the railway whoami command like so:

RAILWAY_API_TOKEN=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX railway whoami

But when I do this, all I get is:

Unauthorized. Please login with `railway login`

Any ideas?

dwilt avatar Apr 06 '25 03:04 dwilt

BusyginArtem avatar Apr 08 '25 11:04 BusyginArtem

Hello,

That would only be possible if that token is an account level token, if you choose a team while creating that token then whoami won't work as a team token does not have the needed scope to read the user data.

brody192 avatar Apr 18 '25 13:04 brody192

i have the same issue, and i saw that was reported about 2 years ago

mfernpoo avatar Nov 04 '25 01:11 mfernpoo

Likely unrelated, we had a API level bug that messed with CLI sessions, considering those resolved for now.

ndneighbor avatar Nov 13 '25 04:11 ndneighbor