Token
Anonymous
HOBBYOP

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:

  1. Whether Account Tokens are currently required for CLI authentication in headless mode
  2. If there are any additional scopes or permissions required for RAILWAY_TOKEN usage
  3. Whether Windows PowerShell requires any specific configuration

Thank you in advance.

Best regards

Solved

1 Replies

Status changed to Awaiting Railway Response Railway 26 days ago


chandrika
EMPLOYEE

25 days 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 25 days ago


Railway
BOT

18 days 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 18 days ago


Welcome!

Sign in to your Railway account to join the conversation.

Loading...