Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const sendSMSCode = async (phone, resolve, reject, { url }) => {
- Platform.OS === 'ios' && WebBrowser.dismissBrowser();
- const tokenEncoded = Linking.parse(url).queryParams['token'];
- if (tokenEncoded) {
- const token = decodeURIComponent(tokenEncoded);
- //fake firebase.auth.ApplicationVerifier
- const captchaVerifier = {
- type: 'recaptcha',
- verify: () => Promise.resolve(token)
- };
- try {
- const confirmationResult = await firebase
- .auth()
- .signInWithPhoneNumber(phone, captchaVerifier);
- resolve(async smsCode => {
- try {
- await confirmationResult.confirm(smsCode);
- } catch (e) {
- console.warn(e);
- }
- });
- } catch (e) {
- reject(e);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement