3 months ago
I'm setting up PR preview environments using the Railway CLI in GitHub Actions, following the official tutorial (https://docs.railway.com/guides/github-actions-pr-environment).
I created a workspace-scoped API token from the Railway dashboard (Workspace Settings > Tokens). The token is set as both RAILWAY_TOKEN and RAILWAY_API_TOKEN environment variables in the workflow.
Even the most basic command fails:
railway whoami
→ "Unauthorized. Please check that your RAILWAY_TOKEN is valid and has access to the resource you're trying to use."
Every CLI command fails with the same error — whoami, link, environment new, etc. The token is freshly generated and correctly set as a GitHub repo secret (verified it's not empty/malformed).
This appears to be the same issue reported here:
https://station.railway.com/questions/unauthorized-please-login-with-railway-22d6a137
Having a basic operation like token authentication not work is deeply concerning. If this can't be resolved quickly, we'll need to evaluate moving off Railway entirely.
3 Replies
3 months 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 Railway • 3 months ago
3 months ago
Also, you should be using a project scoped token.
2 months ago
I've tried using project it didn't work.
What fixed it is to inline the secret -
RAILWAY_TOKEN=${{ secrets.RAILWAY_TOKEN }} railway up --service=XXXXXXthis guide is out-dated: https://blog.railway.com/p/github-actions