android - What is the `Authorization` part of the http post request of Google's Firebase Downstream message? -


i want try send message using google's fcm messaging service , document says, http request should this:

https://fcm.googleapis.com/fcm/send content-type:application/json authorization:key=aizasyz-1u...0gbyzpu7udno5aa  { "data": {     "score": "5x1",     "time": "15:10"   },   "to" : "bk3rnwte3h0:ci2k_hhwgipodkcizvvdmexudfq3p1..." } 

my problem have not idea authorization's value should , when delete header , make request, error 401:unauthorized.i think must kind of api key or cannot find in project. can me?

ps: testing purposes using this site send messsage device

according about firebase cloud messaging server documentation:

authentication

to send message, app server issues post request. example:

https://fcm.googleapis.com/fcm/send

a message request consists of 2 parts: http header , http body.

the http header must contain following headers:

  • authorization: key=your_server_key

    make sure server key, value available in firebase project console under project settings > cloud messaging. client keys or other keys rejected fcm.

  • content-type: application/json json; application/x-www-form-urlencoded;charset=utf-8 plain text.

    if content-type omitted, format assumed plain text.

hope helps!


update (2016/11/16)

perhaps should consider using fcm token instead of server keys note inside following screenshot

enter image description here


update (2016/12/08)

firebase has upgraded server keys new version , recommended upgrade newest version. please see screenshot below:

enter image description here


Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -