[英]Firebase user phone number verification
I can see that Firebase has phone number authentication but all I want is just to verify the phone number.我可以看到 Firebase 具有电话号码身份验证,但我只想验证电话号码。 I do not want to sign in using the phone number.我不想使用电话号码登录。 Can I achieve this or should I use other service for sms verification?我可以做到这一点还是应该使用其他服务进行短信验证?
Verifying the phone number is part of signing the user in to Firebase Authentication.验证电话号码是用户登录 Firebase 身份验证的一部分。 You cannot use Firebase phone number authentication without signing the user in to Firebase Authentication.在用户登录 Firebase 身份验证之前,您无法使用 Firebase 电话号码身份验证。
That said: there are many situations where you can likely leave the user signed in to Firebase without problems.也就是说:在很多情况下,您可以让用户毫无问题地登录 Firebase。
you can just use this你可以用这个
import React from "react";
import StyledFirebaseAuth from 'react-firebaseui/StyledFirebaseAuth';
import firebase from "firebase";
import './firebaseui-styling.global.css';
const config = {
// your firebase config
};
firebase.initializeApp(config);
const PhoneVerification = () => {
const uiConfig = {
signInFlow: 'popup',
signInOptions: [
{
provider: firebase.auth.PhoneAuthProvider.PROVIDER_ID,
recaptchaParameters: {
type: 'image',
size: 'invisible',
badge: 'bottomleft'
},
defaultCountry: '+91',
whitelistedCountries: ['IN', '+91']
}
],
// callbacks: {
// signInSuccessWithAuthResult: function (authResult) {
// var no = firebase.auth.PhoneAuthCredential
// console.log(no)
// }
// }
}
return (
<div>
<StyledFirebaseAuth uiConfig={uiConfig} firebaseAuth={firebase.auth()} />
</div >
)
}
export default PhoneVerification
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.