将 VAPID 注册导入 firebase 要求 OAuth2
import VAPID registrations into firebase asks for OAuth2
我正在按照 google 文档中描述的步骤进行操作:import_push_subscriptions 并且在尝试通过 curl 导入一个 VAPID 注册时收到 401 错误消息:
"Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project."
我的请求是这样的:
curl -X POST -H "Authorization:key=hidden-authorization-key"
-H "Content-Type:application/json"
-d @data.json https://iid.googleapis.com/v1/web/iid
这里是data.json内容
{"endpoint": "https://fcm.googleapis.com/fcm/send/hidden-endpoint-hash",
"keys": {
"auth": "hidden-auth",
"p256dh": "hidden-p256dh"}
}
注意:当我们通过此处描述的 batchImport 端点导入 ios 令牌时,我们使用了相同的隐藏授权密钥:create_registration_tokens_for_apns_tokens 按预期工作但 webpush 导入要求 OAuth2很奇怪,因为我们要发送 Authorization:key.
firebase 团队似乎修复了它。我刚刚尝试将新创建的 VAPID 注册发送到 firebase,并获得了长令牌作为响应。
我正在按照 google 文档中描述的步骤进行操作:import_push_subscriptions 并且在尝试通过 curl 导入一个 VAPID 注册时收到 401 错误消息:
"Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project."
我的请求是这样的:
curl -X POST -H "Authorization:key=hidden-authorization-key"
-H "Content-Type:application/json"
-d @data.json https://iid.googleapis.com/v1/web/iid
这里是data.json内容
{"endpoint": "https://fcm.googleapis.com/fcm/send/hidden-endpoint-hash",
"keys": {
"auth": "hidden-auth",
"p256dh": "hidden-p256dh"}
}
注意:当我们通过此处描述的 batchImport 端点导入 ios 令牌时,我们使用了相同的隐藏授权密钥:create_registration_tokens_for_apns_tokens 按预期工作但 webpush 导入要求 OAuth2很奇怪,因为我们要发送 Authorization:key.
firebase 团队似乎修复了它。我刚刚尝试将新创建的 VAPID 注册发送到 firebase,并获得了长令牌作为响应。