FIREBASE WARNING: "code":"app/invalid-credential" && initializeApp() via the \"credential\" property failed to fetch a valid Google OAuth2 access token

1,401 views
Skip to first unread message

Rajkamal Mishra

unread,
Aug 23, 2021, 12:36:22 PM8/23/21
to Dialogflow Essentials Edition users
Dear all,

I am using Realtime Database for accessing and saving my data from past one year. everything was working fine but since past one month logs started showing warning 

@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: SyntaxError: Unexpected token p in JSON at position 4\"."}  

Now I am not able to access my realtime database. I haven't change anything in my code. The snippet of code which has issue is:

const admin_rt = require('firebase-admin');
var admin_rt_config = {
credential?: admin_rt.credential.applicationDefault(),
databaseURL?: "https://.....................firebaseio.com/",
};
var app2 = admin_rt.initializeApp(admin_rt_config, "app2");

let db11 = admin_rt.database(app2);


I have tried all the solutions found in various forum like time synchronization etc.
Kindly, help me sort this. 
Thanks and regards,
Rajkamal Mishra

Rajkamal Mishra

unread,
Aug 23, 2021, 1:07:39 PM8/23/21
to Dialogflow Essentials Edition users
a minor correction in the code section : -- Please ignore ? in the previous post

credential: admin_rt.credential.applicationDefault(),
databaseURL: "https://.....................firebaseio.com/",

Reply all
Reply to author
Forward
0 new messages