使用FCM gem RAILS发送通知时出现身份验证错误

dip*_*ips 2 ruby-on-rails heroku firebase firebase-cloud-messaging

我在导轨中使用FCM宝石

 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}" 
Run Code Online (Sandbox Code Playgroud)

我收到错误消息:“验证发件人帐户时出错”

响应是:

ma = 2592000; v = \“ 37,36,35 \”“”,“ accept-ranges”:[“ none”],“ vary”:[“ Accept-Encoding”],“ connection”:[“ close”]},“ status_code“:401,” response“:”验证发件人帐户时出错。“}

在搜索时,我发现我需要将服务器列入白名单。我正在使用heroku服务器。在哪里可以将其列入白名单?请帮忙

AL.*_*AL. 6

使用FCM时,您应始终使用Firebase控制台中“ 云消息”选项卡中显示的服务器密钥。