1

我正在尝试在我正在维护的 Web 应用程序上集成 Web 推送通知。我使用这个 github repo https://github.com/zaru/webpush作为我的指南。

遵循该指南中包含的内容后,在我的终端上运行此命令:

Webpush.payload_send(message: "Test", endpoint: n.endpoint, p256dh: n.p256dh_key, auth: n.auth_key, vapid: {private_key: "gAdLtJoNQHDXsd1iYxrvttW3YybuJX4GkN8LDMbSIuw=", public_key: "BHByXuCTQs7UuoqBN2MeLjL_gUHfsuhxKkV_QOdhm9mw9Ohl3giAoxdwtwuoXqYnIbaa7UaTC1BvwS8yv_pNOAU="} )

突然,我遇到了这个错误,这里有人遇到和我一样的错误吗?你是怎么解决的?先感谢您。

Webpush::Unauthorized: host: fcm.googleapis.com, #<Net::HTTPForbidden 403 Forbidden readbody=true>
body:
the key in the authorization header does not correspond to the sender ID used to subscribe this user. Please ensure you are using the correct sender ID and server Key from the Firebase console.
4

0 回答 0