RAILWAY_API_TOKEN not being respected.
erlloyd
FREEOP

4 months ago

Hi - I'm trying to get some very basic railway cli commands to work in my github actions, and it is not working at all. I can also reporduce this locally. Just running the following command:

RAILWAY_API_TOKEN= railway whoami gives an Unathorized error.

Any suggestions?

$10 Bounty

11 Replies

Try using the CLI token in Railway CLI's config.json.

It should be located in your home directory under a folder named .railway


brody, sam…
it works 😭 i js tested it myself


4 months ago

Absolutely not recommended. Please use the correctly scoped API key and the applicable variable key.


My bad…
I guess try recreating an account token (make sure its not team token) and try again i guess


erlloyd
FREEOP

4 months ago

I've recreated the token multiple times and I still see the same behavior.


erlloyd
FREEOP

4 months ago

Can we confirm if this is a bug / unexpected behavior?


4 months ago

You would want to use an account scoped token


erlloyd
FREEOP

4 months ago

That's what I'm using


erlloyd
FREEOP

4 months ago

I worked around this for now by writing my own script hitting the GraphQL API, but I'm using the exact same account-scoped token, so I know the token provides access to what I'm trying to do.


jjao
PRO

2 months ago

I'm having the exact same issue, re-generated account tokens multiple times, still not working. I tried project tokens, and it didn't work. I even tried locally, setting up the CLI from scratch in a new repo directory (was initially trying on Github Actions), and with the RAILWAY_API_TOKEN I can't even run whoami. This is almost certainly a bug, and based on erlloyd's experience with the GraphQL API, maybe a bug with the CLI specifically?


jjao
PRO

2 months ago

@erlloyd, ended up resolving my issue. Not sure if you were doing the same thing I did, but when I was creating the token in the accounts page, I wasn't leaving the workspace blank, and was setting it to my default workspace. If you do that in the accounts page, it makes a workspace-scoped token. To create an account-scoped token, you have to create one in the accounts page, but leave the workspace blank (see my attached image).

May or may not be related to your problem, but thought I'd mention it just in case it helps.

Attachments


Loading...