title: How to send firebase refreshToken ? React
body: <p>I am using firebase for the first time. (<strong>React app)</strong> I have 3 social Auth Provider for sign-in. Google, Facebook and Apple. Everything works great until here. But after 1 hour my token expires and I have to sign-out and sign-in again for refreshing my token. I saved the expiration time to my <strong>localStorage</strong> to check if token expires or not, if yes I invoke the <strong>signOut()</strong> function manually. But it doesn't solve the problem and not a good approach. <strong>I can't find how to refreshToken in firebase.</strong> And also, am I need to check expires again and send refreshToken or I have to refresh token on every time page refresh ?</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>import React from 'react'
  import { useHistory } from "react-router";
  import auth from "../utils/Auth";
  
  export const useSocialAuth = () =&gt; {
      
      const history = useHistory();
      const providerFunc = (socialProvider:any) =&gt; {
          const provider = socialProvider();
          provider
            .then((result: any) =&gt; {
              console.log(result)
              auth.login(() =&gt; {
                localStorage.setItem('exp', result.user._delegate.stsTokenManager.expirationTime)
                localStorage.setItem("userID", result.user.uid);
                localStorage.setItem("tocaToken", result.user.multiFactor.user.accessToken);
                history.push("/");
              });
            })
            .catch((err:any) =&gt; console.log(err));
      }
  
        return providerFunc;
    };</code></pre>
  </div>
  </div>
  </p>