Railway tokens are always invalid
nguyenlossratio
PROOP

a month ago

Generated token at account level - added token as environment variable named RAILWAY_TOKEN

Despite closing powershell and opening up a new powershell instance, railway whoami always returns invalid token.

$20 Bounty

5 Replies

Railway
BOT

a month ago

Account-level tokens must be set as RAILWAY_API_TOKEN, not RAILWAY_TOKEN. The RAILWAY_TOKEN variable is reserved for project-level tokens. Renaming your environment variable to RAILWAY_API_TOKEN should resolve the issue.


Status changed to Awaiting User Response Railway 28 days ago


nguyenlossratio
PROOP

a month ago

Now it says RAILWAY_API_TOKEN is invalid


Status changed to Awaiting Railway Response Railway 28 days ago


a month ago

This thread has been marked as public for community involvement, as it does not contain any sensitive or personal information. Any further activity in this thread will be visible to everyone.

Status changed to Open brody 27 days ago


andrewkat52
FREE

a month ago

Hey , go back to railway.com/account/tokens and generate a new token, but this time make sure the workspace dropdown is left completely blank / set to "no workspace". if you selected any workspace (even your default one) when creating the token, it becomes a workspace-scoped token and railway whoami won't work with it so i think thats almost what's happening here


osimarr
PRO

2 days ago

I am having this issue. I create a token (with or without workspace) and I always get unauthorized. But if I use oauth login it works.

This is making my scripted deployment to fail.

(The Railway AI agent told me my 37-chars-long token being generated was supposed to have 40+ chars, but I not very confident in what the AI said)


osimarr
PRO

2 days ago

looks like setting RAILWAY_API_TOKEN worked. The website is misleading and tells to set RAILWAY_TOKEN

UPDATE: I was wrong, it was not fixed. What happened was I am also logged in with oauth and when I unset RAILWAY_TOKEN it used the oauth.

RAILWAY_API_TOKEN does not fix the issue. The tokens Railway is creating to me aren't working.


Welcome!

Sign in to your Railway account to join the conversation.

Loading...