Skip to content

Commit

Permalink
🪟 🐛 Fix email invite dual write to keycloak (#11481)
Browse files Browse the repository at this point in the history
  • Loading branch information
josephkmh committed Mar 3, 2024
1 parent f18c290 commit c2407cb
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -359,9 +359,13 @@ export const CloudAuthService: React.FC<PropsWithChildren> = ({ children }) => {

try {
({ user: firebaseUser } = await signInWithEmailLink(firebaseAuth, email));
await updatePassword(firebaseUser, password);
// Store the password in a ref so that we can use it to create a keycloak user after the firebase user is created
passwordRef.current = password;
await updatePassword(firebaseUser, password).then(() => {
createKeycloakUser({
authUserId: firebaseUser.uid,
getAccessToken: () => firebaseUser.getIdToken(),
password,
});
});
} catch (e) {
await firebaseAuth.signOut();
if (e.message === EmailLinkErrorCodes.LINK_EXPIRED) {
Expand Down

0 comments on commit c2407cb

Please sign in to comment.