Reputation: 31
We are using firebase with google authentication. We chose Google because our application makes Google API calls. We authorize these api calls with the access_token included in authorization payload that is returned from firebase. However, we are having trouble figuring out how to refresh the access_token after it expires.
We need a way to refresh this token without forcing the user to reauthorize. Ideally, I could request the offline access_type when requesting the firebase auth... Is it possible to get an offline access_type Google oauth token through Firebase so that Google will return a refresh_token? With a refresh_token, I think I can grab a new access_token for api calls.
I was trying this but its definitely not supported:
const provider = new firebase.auth.GoogleAuthProvider()
provider.addScope('https://www.googleapis.com/auth/calendar')
provider.setCustomParameters({ access_type: 'offline' }) // not work
firebase.auth().signInWithRedirect(provider)
Upvotes: 2
Views: 445