Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

171
Views
Verify ID Token provided by Google with Firebase in Expo

i recently allowed users to sign-in in my Expo app with Google 0Auth2.0.

The problem is that when i need to verify the token provided in my backend, i have a 400 error.

(only with Token provided by Google not with a token that i get from basic email/password authentification)

  • In my client :
export async function getUser(id){
    console.log("Reading user... ")         
    try{
        const token = await auth.currentUser.getIdToken()
        const response = await axios.get(`${root}/users/get_currentuser/${id}?auth=${token}`)
        return response.data
    }
    catch(err){
        console.log(err.message)
    }
}
  • In my backend :
const get_currentuser = async (req, res) => {

    const id = req.params.id
    const auth = req.query.auth
    try {
        const result = await getAuth().verifyIdToken(auth) // the error is here 
    
        if(result.uid === id){
            try {
                const user = await db.collection("Users").findOne({uid : id})
                res.status(200).json(user)


            } catch (error) {
                res.status(500).json(error)
            }
        }
        else
            res.status(400).json({err : "Connexion impossible"})

    } catch (error) {
        res.status(400).json({err : "Connexion impossible / token error "})
    }
    
}

Thanks in advance for any help !

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Okey ! I found the solution.

I just remember that my Firebase-Admin-SDK wasn't correct because i created a new Firebase project, so i used the wrong Private Key ( the key that we generate in Profil Setting )

So to fix the issue i generated a new Private Key and that helped me.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!