I built a script to download data from the Realtime database, on Mac. Here things work fine. But when tested the script on Windows I get the following error:
@firebase/database: FIREBASE WARNING: {"code":"app/invalid-credential","message":"Credential implementation provided to initializeApp() via the \"credential\" property failed to fetch a valid Google OAuth2 access token with the following error: \"Failed to parse access token response: Error: Server responded with status 400.\"."}
Build a script that access data from Realtime database, using firebase-admin. Run it on Windows.
var admin = require("firebase-admin");
var serviceAccount = require("./adminsdk.json");
admin.initializeApp({
credential: admin.credential.cert(serviceAccount),
databaseURL: "https://<project-id>.firebaseio.com"
});
var db = admin.database();
var dataRef = db.ref("ref");
I found a few problems with this issue:
Possible causes include:
Please use Stackoverflow if you wish to follow up with further questions.
@hiranya911 it worked. Thank you!
@hiranya911 How did you fix the clock sync error?
@hiranya911 How did you solve clock sync error?
Can u provide solution for me
Thanks
Not sure how to fix it for Windows. On Linux you would usually use a service like ntp.
@Andrewvanbeek @meet02 on Windows you just update the OS clock. Something like update current time. I am using dual boot, and every time I log in my Linux distro the windows clock gets desyncronised
On windows, I was able to fix the issue by navigating to change date and time settings > Internet time > change settings > Update now * with the *synchronize with the internet server checkbox checked.
i am experiencing the same issue but when i am running my Nodejs application in a docker container.
@firebase/database: FIREBASE WARNING: {"code":"app/invalid-credential","message":"Credential implementation provided to initializeApp() via the \"credential\" property failed to fetch a valid Google OAuth2 access token with the following error: \"Error fetching access token: Error while making request: getaddrinfo EAI_AGAIN accounts.google.com:443. Error code: EAI_AGAIN\"."}
clocks is synced, is there anyone with the same issue as me ?
Still facing this issue... wish you guys had some guidance because I've already spent a few hours on this :/
I am having this issue too and im not having a clue of where to start to solve it.
For those who are facing this issue, I actually found out that this lib is just for node environments, that is, if you have an frontend app (like my case, a reactjs web app) it won't work. I figured I will probably have to use firebase functions get what I want done (which is deleting a user from firebase auth by UID).
If anyone has anything to add or confirm my thoughts I would really appreciate as well...
My problem was solved sending the data as a miltipart form instead of a json. Forcing us to not use json in node... Wtf.
My problem was solved sending the data as a miltipart form instead of a json. Forcing us to not use json in node... Wtf.
@DiegoMGar Can you elaborate on what you changed to a multipart form? This issue just crept up and I wasn't having problems in the past. Any data you can provide will be extremely helpful!
Most helpful comment
i am experiencing the same issue but when i am running my Nodejs application in a docker container.
@firebase/database: FIREBASE WARNING: {"code":"app/invalid-credential","message":"Credential implementation provided to initializeApp() via the \"credential\" property failed to fetch a valid Google OAuth2 access token with the following error: \"Error fetching access token: Error while making request: getaddrinfo EAI_AGAIN accounts.google.com:443. Error code: EAI_AGAIN\"."}clocks is synced, is there anyone with the same issue as me ?