firebase / firebase/firebase-js-sdk

FR: Add API to refresh IDP access token

Open
#4,850 9 comments 5 reactions 1 assignee Claimed by @yuchenshi View on GitHub
api: auth feature request internal-bug-filed
Dominant language
TypeScript
Stars
5.1k
Forks
1k
Avg merge
2d 21h
Merged PRs (30d)
37

Description

Firebase has a straightforward API for auth with Google. I can get and store the AccessToken upon authentication. So it seems that is the way I should implement the auth, the new and improved Firebase way. Also, Firebase provides a nice redirect flow that works on mobile devices.

However, there is a huge problem...

This will get the Access Token.

```
firebase.auth().getRedirectResult().then(function(result) {
if (result.credential) {
// This gives you a Google Access Token. You can use it to access the Google API.
var token = result.credential.accessToken;
// ...
}

// The signed-in user info.
var user = result.user;
})
```
The access token is available and I can use it to read/write to the drive, ...for an hour. Once that token expires, I can no longer do anything. The user is still logged into Firebase, so I can continue to use the Firebase services, but I would need to force the user to sign in again to access the drive. This won't do!

I'm looking for the equivalent of `GoogleUser.reloadAuthResponse()` in Firebase.

How can I do this?
What is the recommended way to build a web app that accesses both Firebase services and G Suite?
Are there any official examples?

My project is Chrome Extension. And auth through gapi is not working with it.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.