CLI Login Error (macOS 26.3 (25D125))
vagifmammadaliyev
HOBBYOP

a month ago

Can't login using CLI. Checked other open threads regarding that but didn't help.

Terminal used: Ghostty.app

$ railway login
> Open the browser? Yes
# Confirming in the browser
Unauthorized. Please run `railway login` again.
$ railway login --browserless  # same issue
$ railway whoami
Unauthorized. Please run `railway login` again.

Checks performed:

$ env | grep RAILWAY  # no output, no railway token is set
# just in case checked zshrc and zhshenv as well
$ cat ~/.zshrc | grep RAILWAY  # no output
$ cat ~/.zshrenv | grep RAILWAY  # no output

Tried with built-in Terminal.app, doesn't work as well

Version

$ railway --version
railway 4.36.1
$ brew upgrade railway
Warning: railway 4.36.1 already installed
Solved

7 Replies

Railway
BOT

a month ago

Your account is active and on the Hobby plan, so the issue is on the CLI side where the auth token is not being persisted after browser confirmation. The CLI stores credentials in ~/.railway, so try removing that directory with rm -rf ~/.railway and then running railway login --browserless again. If that still fails, try reinstalling the CLI via the shell script (bash <(curl -fsSL cli.new)) instead of Homebrew, as the Homebrew distribution can occasionally have issues with token storage on newer macOS versions. You can also work around this by generating an account token at https://railway.com/account/tokens and setting it as export RAILWAY_API_TOKEN= in your shell.


Status changed to Awaiting User Response Railway about 1 month ago


Railway

Your account is active and on the Hobby plan, so the issue is on the CLI side where the auth token is not being persisted after browser confirmation. The CLI stores credentials in `~/.railway`, so try removing that directory with `rm -rf ~/.railway` and then running `railway login --browserless` again. If that still fails, try reinstalling the CLI via the shell script (`bash <(curl -fsSL cli.new)`) instead of Homebrew, as the Homebrew distribution can occasionally have issues with token storage on newer macOS versions. You can also work around this by generating an account token at [https://railway.com/account/tokens](https://railway.com/account/tokens) and setting it as `export RAILWAY_API_TOKEN=` in your shell.

vagifmammadaliyev
HOBBYOP

a month ago

$ rm -rf ~/.railway
$ brew uninstall railway
$ bash <(curl -fsSL cli.new)  # as in https://docs.railway.com/cli#shell-script-macos-linux-windows-via-wsl
$ rm -rf ~/.railway  # just in case
$ ls -alt ~/ | grep railway  # no output
$ railway login --browserless
Your authentication code is: XXXX-XXXX
Please visit:
  https://railway.com/activate
Unauthorized. Please run `railway login` again.

Also worth noting, then installing via cli.new installs the same version as with homebrew


Status changed to Awaiting Railway Response Railway about 1 month ago


sam-a
EMPLOYEE

a month ago

This is a known bug with the CLI authentication flow that our team is actively investigating. First, please update to the latest CLI version (4.37.2) - you're currently on 4.36.1 - and try logging in again. If that still fails, you can work around it by generating an API token at https://railway.com/account/tokens and setting it in your shell with export RAILWAY_API_TOKEN=.


Status changed to Awaiting User Response Railway about 1 month ago


Anonymous
HOBBY

a month ago

❯ railway -V

railway 4.37.2

❯ railway login

> Open the browser? Yes

Unauthorized. Please run railway login again.

I've run into the same problem.


Status changed to Awaiting Railway Response Railway about 1 month ago


sam-a

This is a known bug with the CLI authentication flow that our team is actively investigating. First, please update to the latest CLI version (4.37.2) - you're currently on 4.36.1 - and try logging in again. If that still fails, you can work around it by generating an API token at https://railway.com/account/tokens and setting it in your shell with `export RAILWAY_API_TOKEN=`.

vagifmammadaliyev
HOBBYOP

a month ago

This worked for me


❯ railway -V railway 4.37.2 ❯ railway login \> Open the browser? Yes Unauthorized. Please run `railway login` again. I've run into the same problem.

vagifmammadaliyev
HOBBYOP

a month ago

Have you tried rm -rf ~/.railway before running railway login?


sam-a
EMPLOYEE

a month ago

This should be fixed in v4.37.4. You can upgrade with:

```

curl -fsSL https://raw.githubusercontent.com/railwayapp/cli/master/install.sh | sh

```

If you installed via Homebrew, uninstall that version first so the new binary takes precedence:

```

brew uninstall railway

```

Let us know if this does not solve your problem.


Status changed to Awaiting User Response Railway about 1 month ago


Status changed to Solved vagifmammadaliyev about 1 month ago


Welcome!

Sign in to your Railway account to join the conversation.

Loading...