祝您有美好的一天...我正在学习Firebase。在我的应用程序中,如何从Unity发送短信(密码验证码)。
有人可以帮助我吗?
答案 0 :(得分:1)
来自Firebase documentation for Unity on sending a SMS verification code:
呼叫
PhoneAuthProvider.VerifyPhoneNumber
,并将用户的电话号码传递给它。PhoneAuthProvider provider = PhoneAuthProvider.GetInstance(firebaseAuth); provider.VerifyPhoneNumber(phoneNumber, phoneAuthTimeoutMs, null, verificationCompleted: (credential) => { // Auto-sms-retrieval or instant validation has succeeded (Android only). // There is no need to input the verification code. // `credential` can be used instead of calling GetCredential(). }, verificationFailed: (error) => { // The verification code was not sent. // `error` contains a human readable explanation of the problem. }, codeSent: (id, token) => { // Verification code was successfully sent via SMS. // `id` contains the verification id that will need to passed in with // the code from the user when calling GetCredential(). // `token` can be used if the user requests the code be sent again, to // tie the two requests together. }, codeAutoRetrievalTimeout: (id) => { // Called when the auto-sms-retrieval has timed out, based on the given // timeout parameter. // `id` contains the verification id of the request that timed out. });
有关完整信息,请参见链接的文档。