7

1. Summarize the problem I am trying to generate a Firebase token to use in a Bitbucket deployment pipeline.

I have firebase-tools installed on a GCE VM, and I am not running firebase-tools on my local (Windows) machine.


On a GCE VM (my build machine), I cloned my code.

I installed firebase tools (on the GCE VM), then cd'd to my code/repo.

I ran: firebase init

Then I ran: firebase login:ci, I was given a URL (in the GCE VM console), [proc@mpi-dev-proc1 bin]$ firebase login:ci

Visit this URL on any device to log in: https://accounts.google.com/o/oauth2/auth?client_id=....

I pasted that into my web browser on my Windows machine, I was asked to chose an account to continue to Firebase CLI. I selected my GCP account.

I am presented with a dialog: "Firebase CLI" wants to access your Google Account..., I click on [Allow]

I am then redirected to a localhost URL: http://localhost:9005/?state=445583251...

WHY?

I don't have a server running on my local windows box, or anything on 'localhost' listening on port 9005,

Why am I presented with a URL to localhost:9005? I don't get it, it makes no sense. What is supposed to happen here?

I am trying to generate a firebase token to use on Bitbucket build/deploy pipelines.

2. Provide background including what you've already tried

A: See the above. I have also gone through Firebase documentation

3. Show some code

I ran this command on the GCE VM where I have firebase-tools installed (on a CentOS 7 VM) firebase login:ci

4. Describe expected and actual results including any error messages

I need to generate a token for a Firebase deploy pipeline (bitbucket), I am working on a GCE VM with firebase-tools are installed.

user10664542
  • 1,106
  • 1
  • 23
  • 43
  • I posted an answer below on what is supposed to happen, and what happens for me. If you don't get the same output, can you show what part of the output you do get? – Frank van Puffelen Sep 17 '19 at 05:14

2 Answers2

3

Try with firebase login:ci --no-localhost, this will not start the localhost process, but you need to open the URL in the browser and paste back the code from the page to get the CI token.

fractalix
  • 431
  • 4
  • 9
2

That process on localhost is started by the Firebase CLI precisely to capture the redirect after you sign in and grant it permission. After this, the CLI continues (for me at least) and prints the token:

$ firebase login:ci

Visit this URL on this device to log in: https://accounts.google.com/o/oauth2/auth?client_id=...&redirect_uri=http%3A%2F%2Flocalhost%3A9005

Waiting for authentication...

✔ Success! Use this token to login on a CI server:

1/8C......gPY

If you check the URL, you'll see the localhost:%3A9005 in there. But as said, you shouldn't have to do anything with that, as it's just part of the internals of the CLI.

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
  • that solution does not work. That is the same command I listed in the problem. When you click on the URL that is generated, It redirects to 'localhost:9005' and it ends there. I am not running anything on localhost. I am running firebase-tools on a GCP VM - in your solution you were not running firebase-tools on a GCP VM, but on your local box. – user10664542 Sep 17 '19 at 14:45
  • As said, the Firebase CLI is supposed to start a process on `localhost:9005` for you. That was one of your questions, which I answered. As I [commented](https://stackoverflow.com/questions/57966307/how-do-i-generate-a-firebase-auth-token-from-the-command-line-for-use-in-extern/57967705?noredirect=1#comment102345723_57966307), the rest of my answer is merely to show what is supposed to happen. If you get something else, show the output you get in a similar format. – Frank van Puffelen Sep 17 '19 at 15:46