I am attempting to use firebase-tools on a remote Linux server via Putty. There is no desktop running on this server.
When I run firebase login, I'm presented with a long url that I need to copy/paste into any other device's browser:
https://accounts.google.com/o/oauth2/auth?client_id=xxxxxxxxxxxx.apps.googleusercontent.com&scope=email%20openid%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcloudplatformprojects.readonly%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Ffirebase%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcloud-platform&response_type=code&state=3kkd93kl&redirect_uri=http%3A%2F%2Flocalhost%3A9005
I copy/paste this into the browser on my local machine, then I authenticate with my Google account, then it attempts to redirect me to
http://localhost:9005/?state=25744816&code=4/mz.....
which is not an actual server running on my machine and is defintely not the address to the remote machine, which doesn't even have port 9005 active.
So the result is that the terminal is still sitting at "Waiting for authentication..."
I see a command called login:ci which says its for non-interactive environments, but it appears to do the same thing as the login command.
How do I get around this issue?
You can use firebase login --no-localhost
It will then prompt a url you can visit from any browser (no matter the machine), like your host.
Log in with your Google account as usual and accept the permission request.
Finally, copy the provided authorization code
And paste it back in your remote machine's terminal. You should get a success message.
来源:https://stackoverflow.com/questions/43828039/how-to-login-to-firebase-tools-on-headless-remote-server

