a month ago
Hello,
I'm experiencing an issue authenticating the Railway CLI using a RAILWAY_TOKEN on Windows PowerShell.
Setup:
- OS: Windows
- Terminal: PowerShell
- Railway CLI installed via npm (@railway/cli)
- Node.js installed and up to date
Problem:
I generated an Account Token from my Railway account and set it as an environment variable:
$env:RAILWAY_TOKEN="my_token_here"
The variable is correctly set (verified via echo), but when running:
railway whoami
I consistently receive:
Unauthorized. Please check that your RAILWAY_TOKEN is valid and has access to the resource you're trying to use.
What I have already tried:
- Regenerating a new Account Token
- Ensuring I am not using project or workspace tokens
- Updating Railway CLI
- Logging out and clearing local config
- Reinstalling CLI via npm
Expected behavior:
CLI should authenticate successfully and return account information.
Could you please confirm:
- Whether Account Tokens are currently required for CLI authentication in headless mode
- If there are any additional scopes or permissions required for RAILWAY_TOKEN usage
- Whether Windows PowerShell requires any specific configuration
Thank you in advance.
Best regards
1 Replies
Status changed to Awaiting Railway Response Railway • about 1 month ago
a month ago
Account tokens must be set as RAILWAY_API_TOKEN, not RAILWAY_TOKEN. The RAILWAY_TOKEN variable is for project-scoped tokens only. Use $env:RAILWAY_API_TOKEN="your_token_here" in PowerShell and railway whoami should work. See the CLI authentication docs for details on both token types.
Status changed to Awaiting User Response Railway • about 1 month ago
a month 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 • about 1 month ago