[CLI] Firebase CLI 3.0.0 on remote server

392 views
Skip to first unread message

Stefan Stammberger

unread,
May 21, 2016, 11:34:01 AM5/21/16
to Firebase Google Group
I've updated the command line tools from version 2.x to 3.0.0 but I've run into trouble authenticating on a remote server.
After starting "firebase login" on command line I've opened the url and approved the request. 
After that it'll redirect to localhost which of course won't work since the server waiting for the response sits on the remote machine.
The CLI just sits there waiting for authentication. I've kept the window open for some time but nothing happened.
This all worked without a problem on my development machine.

Thanks!


Chris Raynor

unread,
May 21, 2016, 1:23:38 PM5/21/16
to Firebase Google Group
Hey Stefan,

You have 2 options for CI environments:

1) On the CI server itself, run:

    firebase login --no-localhost

This takes you through a separate login flow that involves copying and pasting the URL into a browser on a different machine and then copying and pasting a verification code back into the console of the CI server. It logs your CI server in and stores the token in the home directory of the current user so subsequent firebase commands just work.

2) On your development machine, run:

    firebase login:ci

This creates a completely new login session on your development machine (it's not stored anywhere and doesn't affect your current login session). The output is an OAuth refresh token, but that's an implementation detail. To use this token, you need to pass it into every command you want to run with the --token flag, like:

    firebase deploy --token $FIREBASE_TOKEN

The advantages of the first method include not having to worry about passing around the token to every command, and a cached OAuth access token between requests (they last for 1 hour at most). The advantages of the second method include much more granular control over who has access to the token and the ability to put the token in an environment variable (useful for scripting deploys, or CI services like travis so it doesn't have to be in the code)

Hope that helps

Chris

--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-tal...@googlegroups.com.
To post to this group, send email to fireba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/2818f21d-13d4-4f1d-a691-47cf545ad51c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Stefan Stammberger

unread,
May 21, 2016, 4:02:07 PM5/21/16
to Firebase Google Group
Hi Chris,

No. 1 worked like a charm! Maybe a little hint to this option would be helpful when using the normal login option.

Thanks again,
Stefan
Reply all
Reply to author
Forward
0 new messages