2017-07-29 5 views
0
const request = require('request');  
request 
(
    { 
    method: 'POST', 
    uri: 'https://fcm.googleapis.com/fcm/send', 
    headers: 
    { 
     'Content-Type':'application/json', 
     'Authorization':'key= server key' 
    }, 
    body: JSON.stringify 
    (
     { 
     "registration_ids" : [token], 
     "data" : 
     { 
      "msg":"lattitude" 
     }, 
     "time_to_live": 108 
     } 
    ) 
    }, 
    function(e1,r1,b1) 
    { 
    console.log(r1); 
    console.log(b1); 
    } 
) 

答えて

0

私はあなたがAndroidであなたの最後に使用されているものと同じFirebaseコンソールから正しいサーバーキーを使用したことを期待しています。

'Authorization':'key= server key' 
+0

はい、Firebase "project server"キーのサーバーキーです。 –

関連する問題