小编Moh*_*med的帖子

为 Firebase 云消息传递 PHP 生成 OAUTH 令牌

我有一个 PHP 页面,我用它来向我开发的移动应用程序的用户发送通知,该页面直到上个月都工作正常,然后它给了我这个错误

{"multicast_id":5174063503598899354,"成功":0,"失败":1,"canonical_ids":0,"结果":[{"错误":"无效注册"}]}

我尝试使用此链接中的文档生成 OAUTH 令牌 https://firebase.google.com/docs/cloud-messaging/auth-server#node.js 但它需要 NODE.JS 服务器,而我的服务器不支持 Node .Js,我尝试使用 Firebase Admin SDK 但找不到任何内容。这是页面的PHP代码

<?php

//Includes the file that contains your project's unique server key from the Firebase Console.
require_once("serverKeyInfo.php");

//Sets the serverKey variable to the googleServerKey variable in the serverKeyInfo.php script.
$serverKey = $googleServerKey;

//URL that we will send our message to for it to be processed by Firebase.
    $url = "https://fcm.googleapis.com/fcm/send";

//Recipient of the message. This can be a device token (to send to an …
Run Code Online (Sandbox Code Playgroud)

php oauth token firebase firebase-cloud-messaging

7
推荐指数
3
解决办法
7770
查看次数

标签 统计

firebase ×1

firebase-cloud-messaging ×1

oauth ×1

php ×1

token ×1