firebase / firebase-admin-node

Firebase Admin Node.js SDK
https://firebase.google.com/docs/admin/setup
Apache License 2.0
1.62k stars 367 forks source link

Error : '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: .".' #2629

Open Rohan-SE opened 2 months ago

Rohan-SE commented 2 months ago

[REQUIRED] Step 2: Describe your environment

[REQUIRED] Step 3: Describe the problem

Facing this error: '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: .".' I set env also when I check it from console.log I got service account file values as object but still face this error when it hit that post request I got this error

Relevant Code:

that's my code: const admin =require ('firebase-admin') const { getAuth } = require('firebase-admin/auth'); try { admin.initializeApp()

} catch (error) { console.log(error) }

app.post('/api/auth/signup',async(req,res)=>{ try { const {email,password,username} = req.body; const user = await getAuth().createUser({ email, password, }) } catch(error){ console.log(error } }

KennethicEnergy commented 1 month ago

have the same issue