Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/excel/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在Laravel 8中使用Firebase进行Firebase电话号码身份验证,但未找到主机名匹配项_Laravel_Firebase_Firebase Authentication_Laravel 8 - Fatal编程技术网

在Laravel 8中使用Firebase进行Firebase电话号码身份验证,但未找到主机名匹配项

在Laravel 8中使用Firebase进行Firebase电话号码身份验证,但未找到主机名匹配项,laravel,firebase,firebase-authentication,laravel-8,Laravel,Firebase,Firebase Authentication,Laravel 8,这是我的代码,为什么要面对firebase中的错误 错误是: 找不到主机名匹配项 我已经声明了主机类型localhost,但当我尝试发送发送代码的OTP发送代码按钮时,此firebase不起作用 但是re_验证码工作得很好 <html> <head> <title>Phone Number Authentication using Firebase In Laravel 8</title> <!-- CS

这是我的代码,为什么要面对firebase中的错误

错误是:

找不到主机名匹配项

我已经声明了主机类型localhost,但当我尝试发送发送代码的OTP发送代码按钮时,此firebase不起作用

但是re_验证码工作得很好

    <html>
   <head>
      <title>Phone Number Authentication using Firebase In Laravel 8</title>
      <!-- CSS only -->
       <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
       <!-- Js only -->
       <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
   </head>
   <body>
      <div class="container">
      <div class="jumbotron">
      <div class="container text-center">
         <p>Phone Number Authentication using Firebase In Laravel 8</p>
      </div>
      </div>

         <div class="alert alert-danger" id="error" style="display: none;"></div>
         <div class="card">
            <div class="card-header">
               Enter Phone Number
            </div>
            <div class="card-body">
               <div class="alert alert-success" id="sentSuccess" style="display: none;"></div>
               <form>
                  <label>Phone Number:</label>
                  <input type="text" id="number" class="form-control" placeholder="+91********">
                  <div id="recaptcha-container"></div>
                  <button type="button" class="btn btn-success" onclick="phoneSendAuth();">SendCode</button>
               </form>
            </div>
         </div>
         <div class="card" style="margin-top: 10px">
            <div class="card-header">
               Enter Verification code
            </div>
            <div class="card-body">
               <div class="alert alert-success" id="successRegsiter" style="display: none;"></div>
               <form>
                  <input type="text" id="verificationCode" class="form-control" placeholder="Enter verification code">
                  <button type="button" class="btn btn-success" onclick="codeverify();">Verify code</button>
               </form>
            </div>
         </div>
      </div>
      <script src="https://www.gstatic.com/firebasejs/6.0.2/firebase.js"></script>
      <script>
         var firebaseConfig = {
           apiKey: "AIzaSyCg-NbICvCrdlzpPuRGtfFpPKKBxkXqQfE",
           authDomain: "test-e434b.firebaseapp.com",
           databaseURL: "https://test-e434b.firebaseapp.com",
           projectId: "test-e434b",
           storageBucket: "test-e434b.appspot.com",
           messagingSenderId: "108177260",
           appId: "1:1081772606944:web:9817e1803948b1699d1785",
           measurementId: "p266654231222"
         };

         firebase.initializeApp(firebaseConfig);
      </script>
      <script type="text/javascript">
         window.onload=function () {
           render();
         };

         function render() {
             window.recaptchaVerifier=new firebase.auth.RecaptchaVerifier('recaptcha-container');
             recaptchaVerifier.render();
         }

         function phoneSendAuth() {

             var number = $("#number").val();

             firebase.auth().signInWithPhoneNumber(number,window.recaptchaVerifier).then(function (confirmationResult) {

                 window.confirmationResult=confirmationResult;
                 coderesult=confirmationResult;
                 console.log(coderesult);

                 $("#sentSuccess").text("Message Sent Successfully.");
                 $("#sentSuccess").show();

             }).catch(function (error) {
                 $("#error").text(error.message);
                 $("#error").show();
             });

         }

         function codeverify() {

             var code = $("#verificationCode").val();

             coderesult.confirm(code).then(function (result) {
                 var user=result.user;

                 $("#successRegsiter").text("you are regisenter code hereenter code here`ter Successfully.");
                 $("#successRegsiter").show();

             }).catch(function (error) {
                 $("#error").text(error.message);
                 $("#error").show();
             });
         }
      </script>
   </body>
</html>

    <?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

class FirebaseController extends Controller
{
    /**
     * Write code on Method
     *
     * @return response()
     */
    public function index()
    {
        return view('firebase');
    }
}


在Laravel 8中使用Firebase进行电话号码验证
在Laravel 8中使用Firebase进行电话号码验证

输入电话号码 电话号码: 发送代码 输入验证码 验证码 var firebaseConfig={ apiKey:“AIzaSyCg Nbicvcrdlzppurgtfppkkbxkxqfe”, authDomain:“test-e434b.firebaseapp.com”, 数据库URL:“https://test-e434b.firebaseapp.com", 项目D:“测试-e434b”, storageBucket:“test-e434b.appspot.com”, messagingSenderId:“108177260”, appId:“1:1081772606944:web:9817e1803948b1699d1785”, 测量:“p266654231222” }; firebase.initializeApp(firebaseConfig); window.onload=函数(){ render(); }; 函数render(){ window.recaptchaVerifier=new firebase.auth.recaptchaVerifier('recaptcha-container'); recaptchaVerifier.render(); } 函数phoneSendAuth(){ 变量编号=$(“#编号”).val(); firebase.auth(){ window.confirmationResult=确认结果; coderesult=确认结果; console.log(coderesult); $(“#sentSuccess”).text(“消息已成功发送”); $(“#成功”).show(); }).catch(函数(错误){ $(“#error”).text(error.message); $(“#错误”).show(); }); } 函数codevirify(){ var代码=$(“#验证代码”).val(); 代码结果。确认(代码)。然后(函数(结果){ var user=result.user; $(“#successRegsiter”).text(“您是注册人代码,请在此处输入代码,`ter Successfully.”); $(“#successRegsiter”).show(); }).catch(函数(错误){ $(“#error”).text(error.message); $(“#错误”).show(); }); }
您是否在Firbase仪表板设置中设置了主机?