auth.applyActionCode(code)
Applies a verification code sent to the user by email or other out-of-band mechanism.
Type | Description | |
---|---|---|
code Optional | String | A verification code sent to the user. |
function* applyActionCodeSaga(code) {
try {
yield call(rsf.auth.applyActionCode, code);
yield put(applyActionCodeSuccess());
}
catch(error) {
yield put(applyActionCodeFailure(error));
}
}
auth.channel()
Gets a redux-saga Channel which emits every user change.
A redux-saga Channel which emits for every user change.
function* syncUserSaga() {
const channel = yield call(rsf.auth.channel);
while(true) {
const { error, user } = yield take(channel);
if (user) yield put(syncUser(user));
else yield put(syncError(error));
}
}
auth.confirmPasswordReset(code, newPassword)
Completes the password reset process, given a confirmation code and new password.
Type | Description | |
---|---|---|
code Optional | String | The confirmation code send via email to the user. |
newPassword Optional | String | The new password. |
function* confirmPasswordResetSaga(code, newPassword) {
try {
yield call(rsf.auth.confirmPasswordReset, code, newPassword);
yield put(confirmPasswordResetSuccess());
}
catch(error) {
yield put(confirmPasswordResetFailure(error));
}
}
auth.createUserWithEmailAndPassword(email, password)
Creates a new user account associated with the specified email address and password.
Type | Description | |
---|---|---|
email Optional | String | The user's email address. |
password Optional | String | The user's password. |
A firebase.User instance.
function* createUserSaga(email, password) {
try {
const user = yield call(rsf.auth.createUserWithEmailAndPassword, email, password);
yield put(createUserSuccess(user));
}
catch(error) {
yield put(createUserFailure(error));
}
}
auth.deleteProfile()
Deletes and signs out the user.
function* deleteProfileSaga() {
try {
yield call(rsf.auth.deleteProfile);
yield put(deleteProfileSuccess());
}
catch(error) {
yield put(deleteProfileFailure(error));
}
}
auth.linkWithPopup(authProvider)
Links the authenticated provider to the user account using a pop-up based OAuth flow.
Type | Description | |
---|---|---|
authProvider Optional | A firebase.auth.AuthProvider object. | The authentication provider to use for the request. |
A firebase.auth.UserCredential instance.
const authProvider = new firebase.auth.GoogleAuthProvider();
function* linkSaga() {
try {
const data = yield call(rsf.auth.linkWithPopup, authProvider);
yield put(linkSuccess(data));
} catch(error) {
yield put(loginFailure(error));
}
}
auth.linkWithRedirect(authProvider)
Links the authenticated provider to the user account using a full-page redirect flow.
Type | Description | |
---|---|---|
authProvider Optional | A firebase.auth.AuthProvider object. | The authentication provider to use for the request. |
const authProvider = new firebase.auth.GoogleAuthProvider();
function* linkSaga() {
try {
yield call(rsf.auth.linkWithRedirect, authProvider);
} catch(error) {
yield put(loginFailure(error));
}
}
auth.sendEmailVerification(actionCodeSettings)
Sends a verification email to a user.
Type | Description | |
---|---|---|
actionCodeSettings Optional | The action code settings. |
function* emailVerificationSaga(actionCodeSettings) {
try {
yield call(rsf.auth.sendEmailVerification, actionCodeSettings);
yield put(emailVerificationSendSuccess());
}
catch(error) {
yield put(emailVerificationSendFailure(error));
}
}
auth.sendPasswordResetEmail(email, actionCodeSettings)
Sends a password reset email to the given email address.
Type | Description | |
---|---|---|
email Optional | String | The email address with the password to be reset. |
actionCodeSettings Optional | The action code settings. |
function* sendPasswordResetEmailSaga(email, actionCodeSettings) {
try {
yield call(rsf.auth.sendPasswordResetEmail, email, actionCodeSettings);
yield put(sendPasswordResetEmailSuccess());
}
catch(error) {
yield put(sendPasswordResetEmailFailure(error));
}
}
auth.signInAndRetrieveDataWithCredential(credential)
Starts the login process with the given credentials and returns any available additional user information, such as user name.
Type | Description | |
---|---|---|
credential Optional | The authentication credential. |
A firebase.auth.UserCredential instance.
function* loginSaga() {
const credential = yield select(...)
try {
const userCredentials = yield call(rsf.auth.signInAndRetrieveDataWithCredential, credential);
yield put(loginSuccess(userCredentials));
}
catch(error) {
yield put(loginFailure(error));
}
}
auth.signInAnonymously()
Starts the login process as an anonymous user.
A firebase.User instance.
function* loginSaga() {
try {
const data = yield call(rsf.auth.signInAnonymously, authProvider);
yield put(loginSuccess(data));
}
catch(error) {
yield put(loginFailure(error));
}
}
auth.signInWithCredential(credential)
Starts the login process with the given credentials.
Type | Description | |
---|---|---|
credential Optional | The authentication credential. |
A firebase.User instance.
function* loginSaga() {
const credential = yield select(...)
try {
const user = yield call(rsf.auth.signInWithCredential, credential);
yield put(loginSuccess(user));
}
catch(error) {
yield put(loginFailure(error));
}
}
auth.signInWithCustomToken(token)
Starts the login process using a custom token.
Type | Description | |
---|---|---|
token Optional | String | The custom token to sign in with. |
A firebase.User instance.
function* loginSaga() {
const token = yield select(...)
try {
const user = yield call(rsf.auth.signInWithCustomToken, token);
yield put(loginSuccess(user));
}
catch(error) {
yield put(loginFailure(error));
}
}
auth.signInWithEmailAndPassword(email, password)
Starts the login process using an email address and password.
Type | Description | |
---|---|---|
email Optional | String | The user's email address. |
password Optional | String | The user's password. |
A firebase.User instance.
function* loginSaga(email, password) {
try {
const data = yield call(rsf.auth.signInWithEmailAndPassword, email, password);
yield put(loginSuccess(data));
}
catch(error) {
yield put(loginFailure(error));
}
}
auth.signInWithPhoneNumber(phoneNumber, applicationVerifier)
Starts the login process using the specified phone number.
Type | Description | |
---|---|---|
phoneNumber Optional | String | The user's phone number in E.164 format (e.g. +16505550101). |
applicationVerifier Optional | The verifier to use. |
A firebase.auth.ConfirmationResult instance.
const applicationVerifier = new firebase.auth.RecaptchaVerifier('recaptcha-container');
function* loginSaga() {
const phoneNumber = yield select(state => ...)
try {
const confirmationResult = yield call(rsf.auth.signInWithPhoneNumber, phoneNumber, applicationVerifier);
const verificationCode = /* implement your own logic to get the user's verification code */
const credentials = yield call(confirmationResult.confirm, verificationCode);
yield put(loginSuccess(credentials));
}
catch(error) {
yield put(loginFailure(error));
}
}
auth.signInWithPopup(authProvider)
Starts the login process using the specified AuthProvider.
Type | Description | |
---|---|---|
authProvider Optional | A firebase.auth.AuthProvider object. | The authentication provider to use for the request. |
A firebase.auth.AuthCredential instance.
const authProvider = new firebase.auth.GoogleAuthProvider();
function* loginSaga() {
try {
const data = yield call(rsf.auth.signInWithPopup, authProvider);
yield put(loginSuccess(data));
}
catch(error) {
yield put(loginFailure(error));
}
}
auth.signInWithRedirect(authProvider)
Starts the login process using the specified AuthProvider.
Type | Description | |
---|---|---|
authProvider Optional | A firebase.auth.AuthProvider object. | The authentication provider to use for the request. |
const authProvider = new firebase.auth.GoogleAuthProvider();
function* loginSaga() {
try {
yield call(rsf.auth.signInWithRedirect, authProvider);
yield put(loginSuccess());
}
catch(error) {
yield put(loginFailure(error));
}
}
auth.signOut()
Logs the user out.
function* signOutSaga() {
try {
const data = yield call(rsf.auth.signOut);
yield put(signOutSuccess(data));
}
catch(error) {
yield put(signOutFailure(error));
}
}
auth.unlink(authProvider)
Unlinks a provider from a user account.
Type | Description | |
---|---|---|
authProvider Optional | A firebase.auth.AuthProvider object. | The authentication provider to use for the request. |
A firebase.User instance.
const authProvider = new firebase.auth.GoogleAuthProvider();
function* unlinkSaga() {
try {
const data = yield call(rsf.auth.unlink, authProvider);
yield put(unlinkSuccess(data));
}
catch(error) {
yield put(unlinkFailure(error));
}
}
auth.updateEmail(email)
Updates the user's email.
Type | Description | |
---|---|---|
email Optional | String | The user's email. |
function* updateEmailSaga(email) {
try {
yield call(rsf.auth.updateEmail, email);
yield put(updateEmail());
}
catch(error) {
yield put(updateEmailFailure(error));
}
}
auth.updatePassword(password)
Updates the user's password.
Type | Description | |
---|---|---|
password Optional | String | The user's password. |
function* updatePasswordSaga(password) {
try {
yield call(rsf.auth.updatePassword, password);
yield put(updatePasswordSuccess());
}
catch(error) {
yield put(updatePasswordFailure(error));
}
}
auth.updateProfile(profile)
Updates the user's basic profile information.
Type | Description | |
---|---|---|
profile Optional | Object | The profile's displayName and photoURL to update. It can contain a |
function* updateProfileSaga() {
try {
yield call(rsf.auth.updateProfile, {
displayName: "Elon",
photoURL: "elon@x.com"
});
yield put(updateProfileSuccess());
}
catch(error) {
yield put(updateProfileFailure(error));
}
}