I already authenticate user with email and password, but I want to add email link verification using firebase in react native.
So, user have to provide right email address that he/she owned and password, how can I link them or create it.
This is my code for signup:
export const signupUser = ({firstName, lastName, userName, email, password}) => async dispatch => {
dispatch({ type: SIGNUP_SPINNER });
try {
let user = await firebase.auth().createUserWithEmailAndPassword(email, password);
if(user) {
const { currentUser } = firebase.auth();
// add displayName
await currentUser.updateProfile({
displayName: `${firstName} ${lastName}`
});
await firebase.database().ref(`/users/${currentUser.uid}/profile`)
.push({firstName, lastName, userName, email})
.then(async () => {
dispatch({ type: SIGNUP_INITIAL_STATE });
});
}
} catch(err) {
dispatch({ type: SIGNUP_USER_FAIL, payload: 'something went wrong, please try again!!!' });
}
}