Firebase Web Debug Token different each time for App Check - firebase

I can't make my app work in local host with App Check. Each time the generated debug token is different so I can't add it in the console. The only way I made it work is to add programmatically to index.html the custom debug token I generated like this:
self.FIREBASE_APPCHECK_DEBUG_TOKEN = '186152BD-4BAA-blabla';
is there a way to do this only for development environment? I know we can get the environment from Flutter inside flutter from String.getFromEnrironment but I don't know how I would do this with plain javascript before the app loads?
I read that adding localhost to the recaptcha key is a security breach so I didn't want to go that route.

Related

Version maintenance in firebase hosting while using both firebase CLI and REST API for hosting

Our app hosted on firebase hosting is currently updated via firebase CLI. However, our app may get a feature where a user can create some custom static web files and upload a zip file containing those files to our site, after which these files are available as part of the site. (like a wiki/news article). For example: if a user uploads a zip file file which contains an index.html and some images that are linked to the html file, then the site will get updated with these materials and will show them at: oursite.com/username/somearticle/index.html
Through info gathered via this page , it appears that using the Hosting REST API would be able to get the job done. However I have a few questions about the functionality offered by this solution:
To start using the API, we firstly need an access token to authenticate and authorize API requests. Is there a way to get this token for a standard user who's logged in to our site using firebase authentication?
It says in this part of the article that you need the list of all currently existing files and new files in order to update the site. How do I access the list of files that are currently a part of the site?
On a similar note like the above question, we may need to update the app functionality from time to time and those updates are done via the CLI. How do I ensure that these functionality updates don't overwrite updates made by the user? In other words, is there a way to merge updates into the hosting site using CLI commands?
Firebase Authentication users don't have enough privileges to deploy to hosting. The users will need to be collaborators on the Firebase project, which means they'll need to have a Google account.
I recommend checking out my Gist that shows how to deploy a single files, which does something quite similar that what you're trying to accomplish. It gets the list of existing files (and their hashes) in this code fragment.
"When a user uploads a file" doesn't exactly sound alike "version control" to me ...
better use Cloud Source Repositories and add a Build Trigger, which deploys to Firebase Hosting.
Here it's explained: https://cloud.google.com/build/docs/deploying-builds/deploy-firebase
I mean, how else would you'd be able to keep a version history? And if you really want to upload something, just upload, unzip, also commit to git. HTML files are perfectly suitable for that.
The general idea is to have a continuous version history, which automatically deploys itself on change.

Firebase OAuth's callback URL does not include the project ID

I want to use Twitter authentication with Firebase Auth.
As usual I created a project in the firebase console and added a web app, but the project ID is not included in the callback URL, and cannot work with twitter app.
How can fix this?
Thank you for hearing my poor English.
empty callback url
process which caused the problem

How to Allow User Access to Published App Maker App?

I've built an app in App Maker and deployed it, but the user I thought I had given permission to is getting this notification "Sorry, you don't have access to this application."
In the app, I added a role to the data source and added the user to the role from the deployment. I also added the role to each page's security. I verified that App Maker is turned on for all of our users. I've ensured that the user has access to the Google Sheet data tables (both what I imported into the App for preview and the data I exported from the deployment). I've even added the user as a Cloud Sql Viewer in our Cloud SQL instance (don't know if that was necessary). This is my first app and I feel like I'm flying blind. I'm obviously missing something but can't figure out what. Any help is much appreciated!
Make sure all the required models can be accessed by the role you assigned to the user.
If the user has another Google account in the same Chrome session, the browser may be switching them to this external user when opening the app. Sign-out from that account or try incognito.
Make sure the deployment has no restriction as shown here; or if it does, allow the username.

Require initial setup before running spring web app

I'm creating a very simple forums application.
My current problem is i want the user to be prompted with a setup page (what they'll use to set initial settings such as MySQL credentials) if the website has yet to be setup. When they attempt to go to website.com/login, it should redirect them to website.com/setup until the setup is fully finished.
Should i just use an interceptor for this, or is there an alternative? Also, if i use an interceptor, is it possible to "unregister" it when the website has been fully setup?

Facebook authentication not working for nitrous.io meteor app (node.js)

I have a meteor app running in a node.js machine on nitrous.io and the facebook authentication is not working. I created a new app in facebook, added Website as platform, set the App domain to machinename.usw1.nitrousbox.com and the Website's Site URL to http://machinename.usw1.nitrousbox.com (machinename is made up, but I have my own site there) and then I used the public & secret key to set the fb auth in running meteor app. This is all similar to how I've setup apps before, yet when I try to login to this nitrous.io app using fb, I get this from facebook:
Given URL is not allowed by the Application configuration.: One or more of
the given URLs is not allowed by the App's settings. It must match the
Website URL or Canvas URL, or the domain must be a subdomain of one of the
App's domains.
I've tried all different kinds of settings. Any ideas?
There are two ways to solve this.
Option 1:
Meteor looks for a ROOT_URL environment variable to determine the url the app is running, which is http://localhost:3000/ by default. You can keep the setting as is, but you will need to utilize the following credentials within your facebook app configuration:
site_url: http://localhost:3000/
Option 2:
If you want to utilize your preview URL then you will want to set the site_url to it within your facebook app configuration:
site_url: http://machinename.usw1-2.nitrousbox.com
The next step will be to start up Meteor with the following command:
$ ROOT_URL=http://machinename.usw1-2.nitrousbox.com meteor
Alternatively you can follow the Meteor documentation to change your root URL.

Resources