Error login in into Railway CLI

richyrecareyHOBBY

2 years ago

Im using railway login on windows. It opens a browser saying that I logged in correctly, but then prints on display:
Unauthorized. Please login with railway login

And I cant do anything.

I tried deleting the config.json file in $HOME/.railway

I'm on 3.5.1 for windows.

12 Replies

2 years ago

Try using the --browserless flag:

$ railway login --browserless

It opens a browser saying that I logged in correctly, but then prints on display: Unauthorized. Please login with railway login

Is the browser that the CLI opened in the same session as your [https://railway.app](https://railway.app) session? i.e. if you browse to [https://railway.app](https://railway.app) after seeing the "Unauthorized" message, are you logged in there?


richyrecareyHOBBY

2 years ago

Thank you for your answer, Ray.

Yes, I tried with the --browserless flag, with same result: "Unauthorized. Please login with railway login".

When I login without that flag, I'm indeed logged in in my account, with my usual browser. First it says success, but then, if I try to refresh the page, it says:

Error logging in to CLI. Please try again with --browserless
railway login --browserless

Once in a while (1 every 20 times or so), I get an error like this (translated from spanish):

Attempted access to a socket not allowed by its access permissions (os error 10013).


1qasdsw2wswe32w2TRIAL

a year ago

what do I do instead if railway login returns "Error logging in to CLI. Please try again with --browserless" and railway login --browserless returns Problem processing request?


lucadelimaTRIAL

a year ago

I'm having this same problem. Logging in via the web returns a message saying that the login was successful, but when I execute the command I need:
railway add -p mysql
I receive an error saying that I am not authorized and that I should log in with railway login.
I stay in this infinite loop and can't do what I need to do.


a year ago

what cli version are you on? railway --version

latest is 3.5.2


1qasdsw2wswe32w2TRIAL

a year ago

3.5.2 yes


a year ago

Yeah i can reproduce this, but you can still add databases via the + New button when inside your project


federicopenarandaHOBBY

a year ago

I have the same problem, I want to automate project/services with CLI commands, but I'm blocked by this issue, same env: Windows, 3.5.2 version, login successfully but get unauthorized error in console.


a year ago

this is due to the cli trying to add a deprecated legacy plugin, very unintuitive error message.

the code would need to be updated and a new release put out.


jeremyarrabeTRIAL

a year ago

Is there any fix to this? Currently the same problem.


a year ago

please see my message above


lucadelimaTRIAL

a year ago

I opened an issue, and it really is a bgu like brody said.
https://github.com/railwayapp/cli/issues/480


Error login in into Railway CLI - Railway Help Station