Reputation: 223
For validating the api key we can use the following command,
curl --header "Authorization: key=API_KEY" --header CType:"application/json" https://android.googleapis.com/gcm/send -d "{\"registration_ids\":[\"ABC\"]}"
Is there any way , the project id (sender id ) can be validated against the API key for GCM?
Is there any way to get project id with api key or vice versa?
Upvotes: 0
Views: 405
Reputation: 506
For validating the api key we can use the following command,
curl --header "Authorization: key=API_KEY" --header
CType:"application/json" https://android.googleapis.com/gcm/send
-d "{\"registration_ids\":[\"ABC\"]}"
When you send POST request to GCM server, GCM is validating the apikey againest the sender id, so it is validating both sender id and apikey, if your registration_ids
was genarated with a faulty sender id, GCM will return a NotRegistered
error
Upvotes: 2