Я включил signInWithEmailLink()
из firebase в моем приложении-реактиве.
Все работает успешно, пользователь также создан, но я думаю, что прослушиватель onLink(handleLink)
запускается несколько раз и приводит к ошибка даже после входа пользователя в систему.
Журналы:
link is tru
LOG email: email@gmail.com //I have hidden the actual email
LOG email: email@gmail.com
LOG email: email@gmail.com
LOG USer created
LOG EROR: [Error: [auth/invalid-action-code] The out of band code is invalid. This can happen if the code is malformed, expired, or has already been used.]
LOG EROR: [Error: [auth/invalid-action-code] The out of band code is invalid. This can happen if the code is malformed, expired, or has already been used.]
LOG EROR: [Error: [auth/invalid-action-code] The out of band code is invalid. This can happen if the code is malformed, expired, or has already been used.]
Как вы можете видеть, как это происходит несколько раз, как я могу предотвратить это ??
Это мой код:
const handleLink = async link => {
console.log('opened Link: ', link.url);
if (auth().isSignInWithEmailLink(link.url)) {
console.log('link is tru');
try {
const email = await AsyncStorage.getItem('email');
console.log('email: ', email);
await auth()
.signInWithEmailLink(`${email}`, link.url)
.then(() => {
console.log('USer created');
})
.catch(err => {
console.log('EROR: ', err);
});
} catch (err) {
console.log('err: ', err);
}
} else {
console.log('link is false');
}
};
const link = dynamicLinks().onLink(handleLink);
Помощь будет очень признателен