What is the best way to handle Google Access Tokens?
I'm creating a Chrome app in React that uses Firebase Auth. After authenticating, an access token is returned which I then save to state and pass that state as a prop to a component that accesses the Google Drive API:
signInWithPopup(auth, provider)
.then((result) => {
const credential = GoogleAuthProvider.credentialFromResult(result);
const token = credential.accessToken;
}
It works great until the user refreshes the page at which point state resets and the component no longer has access to the token.
My plan was to store the token to local storage and then delete is when the user logs out.
Is this the proper way to about it or is there a better way? Thank you!