Get 401 gcm notification key error https://android.googleapis.com/gcm/googlenotification

im trying to get the notification key from google im, following the documentation from http://developer.android.com/google/gcm/notifications.html and im creating the notification key on the client, but im the problem with the error message after the request 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

+4
source share
2 answers

Your title for projectid is incorrectly marked and uses the project number instead of the API key as a value.

So,

  • change project_id to Authorization as name
  • and as the value key=YOUR_PROJECT_API_KEY , which can be found on the credentials page:

Here you can find your api key through the Credentials page:

0
source

If you create a user notification on your client, you cannot use the create operation. Use "add" instead. As mentioned in the documentation, add creates a notification key if it does not exist.

When creating id_token make sure that you specify the client identifier (and not the API key) in your scope object.

0
source

Source: https://habr.com/ru/post/1204205/


All Articles