Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Generate a Notification Key on the Client" results in HTTP 401 Unauthorized response #52

Open
GoogleCodeExporter opened this issue Mar 16, 2015 · 3 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. Follow the instructions: 
https://developer.android.com/google/gcm/notifications.html#gen-client


What is the expected output? What do you see instead?
Expect HTTP 200 response with notification_key value.
Instead get HTTP 401 Unauthorized response with an HTML body stating the same.


What version of the product are you using? On what operating system?
Google Play Services 6.5.87, Android 5.0.1.


Please provide any additional information below.
POSTing to https://android.googleapis.com/gcm/googlenotification.
Including header Content-Type: application/json; charset=UTF-8.
Including project_id header with project number from Google Developers Console.
Body contains:
- "operation":"add"
- a unique notification_key_name
- a single value for registration_ids that I just received from 
GoogleCloudMessaging.register and can use to successfully send messages from 
the server to the device
- valid id_token (I can verify it and get the payload on the server)

Can you specify in which cases the service will respond with HTTP 401 
Unauthorized?

Original issue reported on code.google.com by pushbit on 9 Feb 2015 at 10:19

@GoogleCodeExporter
Copy link
Author

[deleted comment]

@GoogleCodeExporter
Copy link
Author

what is the exact reason for respond 401 error when i am trying to push a 
notification message to gcm server from third party server by using php script? 
:-(

Original comment by ba...@technomobs.com on 13 Feb 2015 at 7:04

@GoogleCodeExporter
Copy link
Author

ba...@technomobs.com, I would guess that either you are not using a valid "Key 
for server applications" or that key has restricted "allowed IPs".  This issue 
is only for the method of generating a notification key on Android devices 
using a Google auth token, as described in the instructions linked above.

Original comment by pushbit on 13 Feb 2015 at 9:50

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant