>我在轨道中使用FCM gem
fcm = FCM.new(Rails.application.config.api_key)
registration_ids= ["<got from android app>"] # an array of one or more client registration tokens
options = {data: {score: "123"}, collapse_key: "updated_score"}
response = fcm.send(registration_ids, options)
puts "response: #{response}"
我收到错误:"验证发件人帐户时出错">
响应是:
{"body":"\u003cHTML\u003e\u003cHEAD\u003e\u003cTITLE\u003eUnauthorized\u003c/TITLE\u003e\u003c/HEAD\u003e\u003cBODY BGCOLOR=\"#FFFFFF\" TEXT=\"#000000\"\u003e\u003cH1\u003eUnauthorized\u003c/H1\u003e\u003cH2\u003eError 401\u003c/H2\u003e\u003c/BODY\u003e\u003c/HTML\u003e","headers":{"content-type":["text/html;charset=UTF-8"],"date":["星期四, 16 Mar 2017 14:04:27 GMT"],"expires":["星期四, 16 Mar 2017 14:04:27 GMT"],"cache-control":["private, max-age=0"],"x-content-type-options":["nosniff"],"x-frame-options":["SAMEORIGIN"],"x-xss-protection":["1;mode=block"],"server":["GSE"],"alt-svc":["quic=\":443\"; ma=2592000; v=\"37,36,35\"],"accept-ranges":["none"],"vary":["接受编码"],"连接":["关闭"]},"status_code":401,"响应":"验证发件人帐户时出错。
在搜索时,我发现我需要将服务器列入白名单。 我正在使用 heroku 服务器。我可以在哪里将其列入白名单?请帮忙
使用 FCM 时,您应始终使用 Firebase 控制台的"云消息">选项卡中的服务器密钥。