ruby-on-rails - 该请求缺少身份验证 key FCM token

标签 ruby-on-rails ruby ruby-on-rails-4 firebase firebase-cloud-messaging

我正在尝试使用 postman firebase url 进行访问,但它给了我错误。 我已经设置了所有的东西,但它仍然给我错误

这是我在 postman 上遇到的错误

<HTML>
    <HEAD>
        <TITLE>The request was missing an Authentification Key (FCM Token). Please, refer to section &quot;Authentification&quot; of the FCM documentation, at https://firebase.google.com/docs/cloud-messaging/server.</TITLE>
    </HEAD>
    <BODY BGCOLOR="#FFFFFF" TEXT="#000000">
        <H1>The request was missing an Authentification Key (FCM Token). Please, refer to section &quot;Authentification&quot; of the FCM documentation, at https://firebase.google.com/docs/cloud-messaging/server.</H1>
        <H2>Error 401</H2>
    </BODY>
</HTML>


These things I am adding <br/>
url = 'https://fcm.googleapis.com/fcm/send'<br/>
method = POST<br/>
Headers <br/>
Authorization = 'FIREBASE_SERVER_API_KEY'<br/>
Content-Type = application/json<br/>
Body = 
"{"registration_ids":["ids"],"priority":"high\",\"data\":{\"notification_id\":76,\"title\":\"dvxcv\",\"description\":\"xcvxv\",\"image\":\"/uploads/image/image/37513/Screenshot_from_2016-10-17_10_43_59.png\"}}"

最佳答案

所有你首先需要在页眉中做的事情
授权:key='FIREBASE_SERVER_API_KEY'

而且你在解析 json 时遇到问题,你必须删除 '/'

{"registration_ids":["ids"],"priority":"high","data":{"notification_id":76,"title":"dvxcv","description":"xcvxv","image":"/uploads/image/image/37513/Screenshot_from_2016-10-17_10_43_59.png"}}

编辑 如有任何困惑,请按照我的教程 how to integrate firebase with ruby on rails

关于ruby-on-rails - 该请求缺少身份验证 key FCM token ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40738514/

相关文章:

ruby-on-rails - 在 Devise 注册时提交时为 "Unpermitted parameter: email"

ruby-on-rails - 向 ActiveRecord 枚举字段添加属性

ruby-on-rails - 如何强制 Capistrano 部署的应用程序使用我的开发数据库?

ruby - Ruby 中的发送方法

ruby - 检查方法参数的类型

ruby-on-rails-4 - React-router 中没有带链接的 href

ruby-on-rails - Omniauth-facebook 与设计 : "Missing passthru" errors

ruby-on-rails - 为什么 Passenger/mod_rails 文档要求我显式禁用多 View ?

ruby-on-rails - 如何清理 Rails 4 中的原始 SQL

ruby-on-rails - 制作 : execvp: g++: Permission denied