TP-1|Kunal|chat portal firebase auth fix (#859)

This commit is contained in:
Kunal Sharma
2024-02-29 08:42:50 +05:30
committed by GitHub
parent f406646ab5
commit 06954cbc75
2 changed files with 5 additions and 3 deletions

View File

@@ -60,8 +60,8 @@ const useFirestoreUpdates = () => {
if (!isChatUser) return;
if (getFirebaseCurrentUser()) {
listenToFirestoreChanges();
} else if (longhornFirebaseToken) {
signInToFirebase(longhornFirebaseToken, listenToFirestoreChanges);
} else {
signInToFirebase(longhornFirebaseToken || '', listenToFirestoreChanges);
}
}, [agentRefId, longhornFirebaseToken]);

View File

@@ -452,8 +452,10 @@ export const getCallBridgeData = () => {
};
export const signInToFirebase = (longhornFirebaseToken: string, succesCallback: () => void) => {
const token =
longhornFirebaseToken || LocalStorage.getItem(LOCAL_STORAGE_KEYS.LONGHORN_FIREBASE_TOKEN);
firebaseAuth()
.signInWithCustomToken(longhornFirebaseToken)
.signInWithCustomToken(token)
.then(userCredential => {
succesCallback();
})