2
0
mirror of synced 2025-01-11 14:44:12 +00:00

[auth] add verifyPhoneNumber

This commit is contained in:
Salakar 2017-09-24 13:57:59 +01:00
parent 43e17f4b16
commit fd788b9d5d

View File

@ -6,11 +6,13 @@ import ConfirmationResult from './ConfirmationResult';
// providers
import EmailAuthProvider from './providers/EmailAuthProvider';
import PhoneAuthProvider from './providers/PhoneAuthProvider';
import GoogleAuthProvider from './providers/GoogleAuthProvider';
import GithubAuthProvider from './providers/GithubAuthProvider';
import TwitterAuthProvider from './providers/TwitterAuthProvider';
import FacebookAuthProvider from './providers/FacebookAuthProvider';
import PhoneAuthProvider from './providers/PhoneAuthProvider';
import PhoneAuthListener from './PhoneAuthListener';
export default class Auth extends ModuleBase {
static _NAMESPACE = 'auth';
@ -203,6 +205,19 @@ export default class Auth extends ModuleBase {
});
}
/**
* Returns a PhoneAuthListener to listen to phone verification events,
* on the final completion event a PhoneAuthCredential can be generated for
* authentication purposes.
*
* @param phoneNumber
* @param autoVerifyTimeout Android Only
* @returns {PhoneAuthListener}
*/
verifyPhoneNumber(phoneNumber: string, autoVerifyTimeout?: number): PhoneAuthListener {
return new PhoneAuthListener(this, phoneNumber, autoVerifyTimeout);
}
/**
* Send reset password instructions via email
* @param {string} email The email to send password reset instructions
@ -305,10 +320,10 @@ export const statics = {
GithubAuthProvider,
TwitterAuthProvider,
FacebookAuthProvider,
VerifyPhoneState: {
PhoneAuthState: {
CODE_SENT: 'sent',
AUTO_VERIFY_TIMEOUT: 'timeout',
SUCCESS: 'success',
AUTO_VERIFIED: 'verified',
ERROR: 'error',
},
};