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

148
Views
Firebase Auth Refresh Token?

How do I get access to the refreshed token in Firebase Auth?

I'm building a React app, and on the signin button click run Login function. This function gives me a Google API token which I use to access google drive api.

The problem is that is token expires after an hour. This post mentions:

"If you need to know when the SDK refreshes the token in order to get a new one immediately, you should instead use onIdTokenChanged to set up a callback that will be invoked every time the user's token changes."

As such I've gone ahead and set this function up. However, how do I access this new updated token so that I can pass it along to the rest of the app?

Login Function

const login = async () => {
    signInWithPopup(auth, provider)
      .then((result) => {
        // This gives you a Google Access Token. You can use it to access the Google API.
        const credential = GoogleAuthProvider.credentialFromResult(result);
        const token = credential.accessToken;
}

onIdTokenChanged

 onIdTokenChanged(auth, (currentUser) => {
    console.log(currentUser);
    setUser(currentUser);
  });
about 4 years ago · Juan Pablo Isaza
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!