I'm trying to deploy a test web application using Firebase. I found this Google documentation to deploy a test application 1. I am able to clone a Github repository and enable Firebase on the project. The Firebase web app was created, and I used my Google account as an authentication method. I enabled the web app in Cloud Firestore, and everything seems to be working fine on the Firebase side.
My project is being deployed using GCP and running the application using Cloud Shell. The Firebase version installed is 9.22.0. I got to the point where I need to authorize the Firebase CLI with the following command:
firebase login
According to the instructions, I'm supposed to get the following message: “Allow Firebase to collect CLI usage and error reporting information?” and authorize by pressing Y, and enter to generate an URL. I need to paste the URL in the browser to authenticate with the account being used to generate a verification code and then use it in the Cloud Shell prompt.
Once I run the firebase login command, it never prompts me with “Allow Firebase to collect CLI usage and error reporting information?” It generates the link, and I paste it in the browser and I get the following screen:
I have tried cleaning the browser cookies thinking it was a browser issue, but I kept getting the same error. I have tried different browsers, but keep getting the same error. I recreated the project several times, but Cloud Shell never prompts me to allow Firebase. I have created the project in another GCP account, and we have the same problem. The instructions were followed according to the documentation, but I cannot move forward because it is not allowing me to authorize the Firebase CLI. Does anyone have any insight on the issue? Any help would be very welcome.
1 https://firebase.google.com/codelabs/firebase-web#3
As mentioned in this documentation:
The firebase login command opens a web page that connects to localhost on your machine. If you're using a remote machine and don't have access to localhost, run the command with the flag --no-localhost.
Run the following command in your terminal:
firebase login --no-localhost
Tried the steps in the documentation you provided and I was able to launch the app successfully.
Related
As per the Firebase documentation, the contents of google-services.json are considered public. These can be easily retrieved by decompiling the apk.
If so, is there a way to prevent apps from registering with my Firebase project?
I understand that the registration works on the basis of package name. While it's not possible to publish an app with a duplicate package name, for development it is very much possible.
I created a dummy app, and my dummy app successfully registered with my production project. So, looking for a way to prevent that from happening.
You should be connecting your app to Firebase Emulator for local development.
You can go to Firebase console -> Authentication tab -> Sign-in Method tab, and remove localhost from Authorized domain, that way your app will never connect to production DB.
i Already hosted a Web page Project to Filebase console using firebase deploy comment , How can i Download the Project files Now ?
firebase deploy
You can not download the project files...
That you can download is the data/files you have stored in your realtime database or firestore database.
You can switch between deploys as well, you can roll back to older deploy or to the newer depending of your needs, but you can not download any of it.
There is no blanket "code pull" from Firebase, so you will need to take a different approach for each product.
Product
How to get the code/data
Hosting
There is no API to get your hosted files back from Firebase, but you can usually get pretty close by crawling the site. See Pull lost code from Firebase Hosting deployment
Realtime Database
You can either use one of the SDKs, use the REST API (for small databases this may be as simple as adding .json to the end of the database URL), or you can set up automatic backups and get the data from there.
Firestore
You can either use one of the SDKs or REST API here too, or you get export through the console or gcloud CLI as explained here
Authentication
You can export all your users through the Admin SDK or the Firebase CLI
Cloud Functions
The closest you can get here is to copy/paste the code from the Google Cloud console as explained here: Get code from firebase console which I deployed earlier
Background: I'm creating a website that will deploy websites using firebase. The one-liner is that they fill out information and the web app deploys a website with that information. It's a Node app with react frontend and express backend. I plan to deploy this on firebase too but I'm not attached to this idea. I wrote an npm script that will create a project and deploy a site on the firebase project but it only works because I'm already logged in on my machine. Currently, it logs in through the web interface using OAuth2.0 and my google account. I cant find anything online on this. All my search results bring me to firebase's authentication feature.
Question: Are there alternative programmatic ways to login to firebase? If not, do you have any guidance on how I can accomplish this otherwise?
I think you're confused about what it means to be "logged in to firebase".
If you asking how to automate deployment with the Firebase CLI, without needing to sign in using a browser to authenticate your identity, then you should read the documentation about using the CLI with CI systems. You can sign in once manaully and get a token, then use that token on the command line to perform you deployment without having to manually sign in again.
Recently tried to start up a new project in my firebase console, to allow another developer to run an instance of our app. The web based SPA-style app is written using Firebase 2.0. Using authwithpassword, I get back an error “This Firebase project requires import into Google Cloud Platform to resume service.“.
As far as I can tell, the project does exist in my cloud platform console. Any ideas? Is this a usage limit error?
There was another question out there on this error message, but that related to a user who specifically did not want to place a project on the cloud servers. In this case, the error message is displaying even though the project is already managed on Google Cloud Platform.
For logging purposes I´d like to print to console or even display the current deploy ID (or message) of my firebase web app that is being accessed by the browser.
Firebase Hosting recently released a new REST API. You can use sites.releases.list to see what version is currently deployed.
Old answer:
Firebase deploy IDs don't appear to be available anywhere via programmatic access. The CLI doesn't support listing current or previous deploys.
My recommendation would be to go in the other direction. Have your source code in a vcs like git. When you build and deploy a new version set the vcs hash or version in the deployed code and as the message for firebase deploy. You can then log the log the source version in your code and you can manually associate that back to a release in the Firebase UI.