2
0
mirror of synced 2025-01-25 22:00:22 +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 // providers
import EmailAuthProvider from './providers/EmailAuthProvider'; import EmailAuthProvider from './providers/EmailAuthProvider';
import PhoneAuthProvider from './providers/PhoneAuthProvider';
import GoogleAuthProvider from './providers/GoogleAuthProvider'; import GoogleAuthProvider from './providers/GoogleAuthProvider';
import GithubAuthProvider from './providers/GithubAuthProvider'; import GithubAuthProvider from './providers/GithubAuthProvider';
import TwitterAuthProvider from './providers/TwitterAuthProvider'; import TwitterAuthProvider from './providers/TwitterAuthProvider';
import FacebookAuthProvider from './providers/FacebookAuthProvider'; import FacebookAuthProvider from './providers/FacebookAuthProvider';
import PhoneAuthProvider from './providers/PhoneAuthProvider';
import PhoneAuthListener from './PhoneAuthListener';
export default class Auth extends ModuleBase { export default class Auth extends ModuleBase {
static _NAMESPACE = 'auth'; 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 * Send reset password instructions via email
* @param {string} email The email to send password reset instructions * @param {string} email The email to send password reset instructions
@ -305,10 +320,10 @@ export const statics = {
GithubAuthProvider, GithubAuthProvider,
TwitterAuthProvider, TwitterAuthProvider,
FacebookAuthProvider, FacebookAuthProvider,
VerifyPhoneState: { PhoneAuthState: {
CODE_SENT: 'sent', CODE_SENT: 'sent',
AUTO_VERIFY_TIMEOUT: 'timeout', AUTO_VERIFY_TIMEOUT: 'timeout',
SUCCESS: 'success', AUTO_VERIFIED: 'verified',
ERROR: 'error', ERROR: 'error',
}, },
}; };