如何在无头远程服务器上登录`firebase-tools`?

Jak*_*son 8 linux firebase firebase-tools

我试图firebase-tools通过Putty在远程Linux服务器上使用.此服务器上没有运行桌面.

当我跑步时firebase login,我会看到一个长网址,我需要将其复制/粘贴到任何其他设备的浏览器中:

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
Run Code Online (Sandbox Code Playgroud)

我将其复制/粘贴到我本地计算机上的浏览器中,然后使用我的Google帐户进行身份验证,然后尝试将我重定向到

http://localhost:9005/?state=25744816&code=4/mz.....
Run Code Online (Sandbox Code Playgroud)

这不是我的机器上运行的实际服务器,并且绝不是远程机器的地址,远程机器甚至没有活动端口9005.

结果是终端仍然坐在"等待认证......"

我看到一个命令叫做login:ci非交互式环境,但它似乎与login命令做同样的事情.

我该如何解决这个问题?

UnJ*_*ter 31

您可以使用 firebase login --no-localhost

然后它会提示您可以从任何浏览器(无论机器)访问的URL,例如您的主机.

登录url提示响应

像往常一样使用您的Google帐户登录并接受权限请求.

最后,复制提供的授权码

您访问过的网址的授权码

然后将其粘贴回远程机器的终端.你应该得到一个成功的消息.