【发布时间】:2022-11-07 15:33:51
【问题描述】:
我正在测试我的项目的 Firebase 消息。我正在使用 OAuth 2.0 Playground 将有效负载发送到“messages:send”rest API。 但是,在发送请求时,它会返回“500 Internet 服务器错误”。 我在另一个相同的项目(自然具有不同的项目 ID)上做同样的事情,它没有问题。有谁知道为什么? 我已经在谷歌云中启用了 API 服务。 唯一的区别是我登录到不同的 Firebase Google 帐户,因为它们是 2 个不同客户的 2 个不同项目。
编辑:附加信息 - 这仅在使用从 Microsoft Edge 浏览器生成的令牌时发生。通过 Firefox 和 Chrome 提供的用户令牌可以正常工作。
HTTP 方法:POST
请求 URI:https://fcm.googleapis.com/v1/projects/myprojectnamehere/messages:send
要求:
POST /v1/projects/myprojectnamehere/messages:send HTTP/1.1
Host: fcm.googleapis.com
Content-length: 867
Content-type: application/json
Authorization: Bearer yj29.a0AV...........(removed for example code)
{
"message": {
"token": "thetokenId...(removed for example code)",
"data": {
"body":"Body of Your Notification in data",
"title":"Title of Your Notification in data",
"image":"http://image.shutterstock.com/image-vector/sample-stamp-rubber-style-red-260nw-1811246308.jpg",
"icon":"http://image.shutterstock.com/image-vector/sample-stamp-rubber-style-red-260nw-1811246308.jpg",
}
}
}
回复:
HTTP/1.1 500 Internal Server Error
Content-length: 253
X-xss-protection: 0
X-content-type-options: nosniff
Transfer-encoding: chunked
Vary: Origin, X-Origin, Referer
Server: scaffolding on HTTPServer2
-content-encoding: gzip
Cache-control: private
Date: Wed, 24 Aug 2022 14:17:43 GMT
X-frame-options: SAMEORIGIN
Alt-svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"
Content-type: application/json; charset=UTF-8
{
"error": {
"status": "INTERNAL",
"message": "Internal error encountered.",
"code": 500,
"details": [
{
"errorCode": "INTERNAL",
"@type": "type.googleapis.com/google.firebase.fcm.v1.FcmError"
}
]
}
}
【问题讨论】:
标签: firebase firebase-cloud-messaging oauth2-playground