Why FirebaseDB component is not working in localhost?

Screenshot (219)

I used no blocks

  1. Remove the FirebaseToken, just leave it empty
  2. Internet connection required for Firebase
  3. Ensure your Firebase project is using the US server

Thanks for your reply @TIMAI2

Then, how will I access the data from database ?

My pc and phone both are connected to a strong wifi.

In Appinventor online, FirebaseDB works for me. And in localhost, its not working. How can I use the US server ? Using a VPN ?

Then, how will I access the data from database ?

Usually just works. However, if you must, ensure you are using the API key from the project

You would need to create a new Firebase project

Your alternative is to use the web component and the Firebase REST api

1 Like

Yes, I confirm that.
I tested it on my Pixel 4XL (Android 12) with the APK built with the current version of AI2Offline (v4.5.4).
@Ramiro

1 Like

@Anke , This is not only happens in Ai2Offline but also in Appinventor(running locally). There is a code in MockFirebaseDB which enters the FirebaseToken inside FirebaseDB component when dropped to Viewer. The generated token is related to firebase authentication . In offline, its not generating because the server is either not online or not using firebase for authentication.

Sir @ewpatton, please have a look here

Something similar happens with the Translator component on the local server, when dragging it to the designer an error occurs, an "empty key".

1 Like

Means a app with Translator component also crashes ?

There is no Transaltor component in AI2Offline (v4.5.4) - right AI2 (online):

But when I import a project with this component from AI2 online, there is no problem with AI2Offline.

The only way for the translation to work in the apk is to copy the ApiKey from the online version to the local version, however there is another problem, if you log out when you start again the ApiKey field will be empty.

Edit. Well I think I found a way.

1 Like

Thanks @anke and @Ramiro. But I am using FirebaseDB component. Do you know any solution for it ?


I guess you have to modify these lines, but I've never tried

1 Like

Thanks @Ramiro , I will try it.

Yes, I did it exactly this way. But as I said, there is no Translator component in the Media section.
You have to get it this way:

1 Like

Modify to what?

1 Like

So what is your question?
Do you see this component in AI2Offline (current version)?
If so, take a screenshot and post it. (I want to see it with my own eyes. :wink:)

Spelling error

If there are no other problems...

1 Like

FirebaseDB, CloudDB, and Translator all use a token-based authentication mechanism for validating access from client apps built with AI2. In the case of CloudDB and Translator specifically, these are services run by MIT and so we use the tokens to both authenticate and rate limit access to our servers so that any particular user can't abuse the service to the detriment of other users. In the case of FirebaseDB, we use a Firebase-provided library to derive a JSON Web Token (JWT) that is used to identify the app to Firebase as well as restrain its access to a bucket that is specific to app's developer. Otherwise, App Inventor users could abuse their tokens to read/write other developers buckets and it would be a mess. For security reasons, the private keys needed to derive these tokens are not published with the sources.

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.