I'm building a chrome extension in React using Firebase Auth for login. The google api access token expires after 1 hour and I can't use the gapi client library in a chrome extension.
As such I'm manually refreshing the token by calling google's api. However, how do I get access to the refresh token?
According to this post, a refresh token is returned only after the first sign in, so I used the instructions to remove access and re-prompt permissions. Console.logging credential returned the following but no refresh token:
accessToken: "ya29..."
idToken: "eyJhbGciOiJSUz..."
pendingToken: null
providerId: "google.com"
signInMethod: "google.com"
Sign In code:
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;
}
Any idea how to get the google api refresh token?