6

我想用postman firebase url命中,但它给了我错误。 我已经安装所有的东西,但它仍然是给我的错误该请求缺少一个认证密钥FCM令牌

这里是我的邮差

<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\"}}" 

回答

4

所有你首先需要做的头收到错误
授权:键= '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

+0

我在Postman中得到相同的消息,并且我拥有Authorization:key =(这是显示在Cloud消息选项卡中的FCM令牌) –

+0

那么您是如何解决的? – ankur

+0

还没有发现什么是错的。 –

1

下接头,授权:键= AAAA .....

必须在火力地堡服务器密钥令牌的前面加上“键=”! !

+0

这工作。做得好。 – kamyFC