firebase / firebase/firebase-js-sdk
User is not refreshed after applyActionCode
- Dominant language
- TypeScript
- Stars
- 5.1k
- Forks
- 1k
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 37
Description
### [REQUIRED] Describe your environment
* Operating System version: OSX
* Browser version: Chorme 88.0.4324.182
* Firebase SDK version: 8.2.5
* Firebase Product: auth
#### Steps to reproduce:
It's possible to write custom email handlers https://firebase.google.com/docs/auth/custom-email-handler.
However after running firebaseApp.auth().applyActionCode(oobCode) firebaseApp.auth().currentUser is not refreshed automatically. Which means in email-verify case that firebaseApp.auth().currentUser seems to still have unverified email. It's also possible to call firebaseApp.auth().currentUser.reload() after but this does not cause onAuthChanged/onIdTokenChanged event handlers to be called.
Currently fixed by calling firebaseApp.auth().currentUser.getIdToken(true) in the end but I think this should happen automatically or added to documentation.
#### Relevant Code:
```javascript
// assume user is already loggedIn
await firebaseApp.auth().applyActionCode(oobCode);
await firebaseApp.auth().currentUser.getIdToken(true); // without this loggedin user is not refreshed
```
Contributor guide
Assessment
This issue has not been assessed yet.