Railway CLI - Not Authenticaing
wayne
PROOP

8 months ago

I'm creating a new account token. I am running the following line, with the newly created token:

RAILWAY_API_TOKEN={{actual_token_here}} railway whoami

Unauthorized. Please login with railway login

I'm running the following version: railway 4.5.4

I cannot seem to authenticate. My ultimate goal is to run tests against a GitHub workflow. However, the project token is associated with a specific environment, and I can't keep creating project tokens per PR environment. I need them to be dynamically created per PR environment or on a project, not a specific environment in the project, to see the database through a GitHub workflow. I was therefore trying against a Railway account token, however it's not letting me authenticate and it is not therefore allowing me to check the database service variables. I did read somewhere that having two tokens, the Railway CLI prefers the Project token. However, I deleted the Project token to try out the Account token.

Solved

2 Replies

8 months ago

Where are you running this? Is this inside a GH workflow? Can you try echo-ing the value to verify it's present in env vars (echo $RAILWAY_API_TOKEN && railway login)?


Status changed to Awaiting User Response Railway 8 months ago


8 months ago

Can you also make sure you are not using a team-scoped token as that kind of token would not have the necessary authentication to pull user account data that whoami shows.


Railway
BOT

7 months ago

This thread has been marked as solved automatically due to a lack of recent activity. Please re-open this thread or create a new one if you require further assistance. Thank you!

Status changed to Solved Railway 7 months ago


Loading...