im trying to get notification key from google service im following the documentation from http://developer.android.com/google/gcm/notifications.html and im Generating a Notification Key on the Client but im having a problem with the post request getting error 401 OK
{
"operation": "create",
"notification_key_name": "vitee",
"registration_ids": ["********"]
"id_token": "**************************************************"
}
here is a snapshot of my request
![enter image description here][1]
https://lh5.googleusercontent.com/QmTDFWwjkyPtLFVVcTN4IYwkVhHU42wcUKPjpg_E8KSR3ALAXJ2Js-0K2gzlmmOEUXfrGe1TS8s=w1890-h820
Your header for projectid
is mislabeled and is using the project number instead of the API key as the value.
So,
- change
project_id
to Authorization
as the name
- and as the value
key=YOUR_PROJECT_API_KEY
which may be found on the Credentials page:
Here's some help to find your api key via the Credentials page:
- https://console.developers.google.com/project?authuser=0
- Click the project you want (in case you have more than one)
- Click API & auth (if it isn't expanded already)
- Click Credentials (underneath API & auth)
- And then you will find your API key on this screen
If you are creating a user notification on your client, you cannot use the "create" operation. Use "add" instead. As mentioned in the documentation, "add" creates the notification key if it doesn't exist.
In generating the id_token
, make sure that you specify the client ID (not API key) in your scope
object.