通过两个Firebase项目发送推送通知

我正在使用Admin SDK for node.js发送推送通知。 跟随教程,并用这个链接给出的例子初始化多个项目。

我需要知道如何使用node.js发送两个项目的推送通知。 在下面的方法中使用发送通知两个项目的基础上与默认项目的工作,但另一个项目得到如下错误

exports.send_test_mailer = function(req, res) { // Default project var registrationToken = ["f-vRsDouUFQ:APA91bGktVzu3WjKGqeXqdiYPI8B0lQXs34TkJS4p7LaMiFGfp5LdfB1ZjEhO3CY5ci92apqgt1hEJY0ml11C4hxYUaPfDl7PeDHhcmDGur0JUx5l3M2mLEj30epwRBWVsE4xMSTls4f"]; var payload = { notification: { title: "driver app", body: "driver app push notfications on the day." }, data: { score: "850", time: "2:45" } }; firebaseAdmin.messaging().sendToDevice(registrationToken, payload) .then(function(response) { console.log("Successfully sent message driver:", JSON.stringify(response)); }) .catch(function(error) { console.log("Error sending message driver:", JSON.stringify(error)); }); // Second project var registrationTokens = ["dzXRXUMIB5w:APA91bHSArtroO8M33IHxaslQTugTcEzJcfkbsXEhwbXbvVzBws-aqG4aqKNr37j8WpZev7lolX7cFQlAKYZ1QV_EgC6zTGeT41n3lvSpcDyBg6t4SZZaoPe7nUO9sbdcXA2KDguxAbk"]; var payloads = { notification: { title: "customer app", body: "customer app push notfications on the day." }, data: { score: "850", time: "2:45" } }; firebaseAdmin.messaging().sendToDevice(registrationTokens, payloads) .then(function(response) { console.log("Successfully sent message customer:", JSON.stringify(response)); }) .catch(function(error) { console.log("Error sending message customer:", JSON.stringify(error)); }); }; 

错误

 {"results":[{"error":{"code":"messaging/registration-token-not-registered","message":"The provided registration token is not registered. A previously valid registration token can be unregistered for a variety of reasons. See the error documentation for more details. Remove this registration token and stop using it to send messages."}},{"error":{"code":"messaging/mismatched-credential","message":"The credential used to authenticate this SDK does not have permission to send messages to the device corresponding to the provided registration token. Make sure the credential and registration token both belong to the same Firebase project."}}],"canonicalRegistrationTokenCount":0,"failureCount":2,"successCount":0,"multicastId":9014981858701063000}