firebase:“无法解析身份验证令牌。”

2024-04-30

你好,我正在使用 firebase 和 php 并使用这个library https://github.com/ktamas77/firebase-php#supported-commands.

我收到此错误。“无法解析身份验证令牌。”

我的身份验证令牌是正确的,因为我也在 node.js 中使用了相同的令牌。

我的代码看起来像这样

       require "vendor/autoload.php";
       const DEFAULT_URL = 'https://xxxxxxxxx.firebaseio.com';
       const DEFAULT_TOKEN = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';

       $firebase = new \Firebase\FirebaseLib(DEFAULT_URL, DEFAULT_TOKEN );  

        $data = [
        "Website_Name"=> $Website_Name,
        "Username" =>  $Username,
       "Password"=> $Password,
       "website_link"=> $website_link,
       "id"=> $id,
       ];



        $path = "per_users";
        $res = $firebase->push('/per_users', $data);
        // per_users is the name of the table
        var_dump($res); 

你能告诉我我到底做错了什么吗? 谢谢。


我发现以下解决方案有效,如果有人仍然想使用主题启动器library https://github.com/ktamas77/firebase-php#supported-commands:

  1. Go to Firebase 控制台 https://console.firebase.google.com/并选择您的项目。
  2. 转到项目设置(按左上角概述旁边的齿轮图标)
  3. 转到服务帐户选项卡
  4. 选择数据库密钥,显示并复制该库的数据库密钥const DEFAULT_TOKEN
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

firebase:“无法解析身份验证令牌。” 的相关文章

随机推荐