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