Skip to content

Commit

Permalink
🪟 🐛 Force refresh of firebase token after verifying email (#21687)
Browse files Browse the repository at this point in the history
  • Loading branch information
josephkmh authored Jan 23, 2023
1 parent dd0706e commit 0fbd3b2
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion airbyte-webapp/src/packages/cloud/lib/auth/GoogleAuthService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import {
signInWithPopup,
GoogleAuthProvider,
GithubAuthProvider,
getIdToken,
reload,
} from "firebase/auth";

import { Provider } from "config";
Expand Down Expand Up @@ -144,7 +146,13 @@ export class GoogleAuthService {
}

async confirmEmailVerify(code: string): Promise<void> {
return applyActionCode(this.auth, code);
await applyActionCode(this.auth, code);

// Reload the user and get a fresh token with email_verified: true
if (this.auth.currentUser) {
await reload(this.auth.currentUser);
await getIdToken(this.auth.currentUser, true);
}
}

async signInWithEmailLink(email: string): Promise<UserCredential> {
Expand Down

0 comments on commit 0fbd3b2

Please sign in to comment.