question

mrzoidberg avatar image
mrzoidberg asked

400 Bad Request {"reason":"InvalidRegistrationId"}.

So, I have one security profile with many keys, using them I successfully send messages, except for one key which always throws InvalidRegistrationId error. In all cases, to obtain access token, I use the same Client ID and Client Secret, differ only keys in assets/api_key.txt. All keys have the same signature, but different package names. Access token response: "HTTP/1.1 100 Continue[EOL]" "grant_type=client_credentials&scope=messaging%3Apush&client_id=xxxxx&client_secret=xxxxx" "HTTP/1.1 200 OK[EOL]" "Date: Wed, 12 Mar 2014 08:20:48 GMT[EOL]" "Server: Server[EOL]" "x-amzn-RequestId: 37710c4e-a9bf-11e3-890b-71fc92c48da0[EOL]" "Content-Type: application/json[EOL]" "Content-Length: 287[EOL]" "Vary: Accept-Encoding,User-Agent[EOL]" "{"scope":"messaging:push","token_type":"bearer","expires_in":3600,"access_token":"Atc|MQEBIDfJyc64JCW9mzdZLvB1J5Up5HqIG5kWHcyFGPS6LOJunkUS83VfGHzHj9-NVsiSsMN69QQ5eQHtbqJctNv9RZl58PT13PiT5KLWvr3f1a1-MC-KmF2kG1kpPK5KoWcATuIjyBK0DH3btHkxI8KlNZuO-KWYOAaVBxLffkLopJAN5OD2RUc_jGCysnvJZCCMt3U"}" Sending a message responce: "HTTP/1.1 400 Bad Request[EOL]" "Date: Wed, 12 Mar 2014 08:20:49 GMT[EOL]" "Server: Server[EOL]" "x-amzn-RequestId: 37cfce95-a9bf-11e3-8dd2-1f385814045b[EOL]" "Content-Type: application/json[EOL]" "Content-Length: 35[EOL]" "Vary: User-Agent[EOL]" "Cneonction: close[EOL]" "{"reason":"InvalidRegistrationId"}[\n]" What's causing this strange behavior? Message was edited by: Sujoy@Amazon
amazon device messaging
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Sujoy@Amazon avatar image
Sujoy@Amazon answered
Hi Mrzoidberg, Thank you for reaching out. I need to clarify few things since I did not find any Security Profile associated with account you are using for this post. So you have one security profile and created many API keys in that profile for different packages. You receive successfully registration id for all the apps of the packages you have used to create API key. Right? Now while one (received from the package associated with a particular problematic API Key) of the registration ids is used to send a message, it's failing with InvalidRegistrationId error reason? Am I right? I have deleted the client id and secret from your post since it should not be publicly visible. Please answer from the account which has the said profile defined so that I can track it.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

mrzoidberg2 avatar image
mrzoidberg2 answered
Thanks for your quick reply. I'm replying from account which contains the above Security Profile (Bubble Fairyland). This profile includes four api key, two of which I used for testing: "test.bubblefairyland" and "air.bubblefairyland". Using these two keys I'm able to receive registration id and to send messages. Using the remaining keys I'm also able to receive registration id, but can't send a message because of InvalidRegistrationId error.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Sujoy@Amazon avatar image
Sujoy@Amazon answered
I did not find any user against email id starting with valeriu@compu... Can you raise a ContactUs ( https://developer.amazon.com/help/contactus.html) and say there that you are redirected from this thread ( https://forums.developer.amazon.com/forums/thread.jspa?threadID=3095&tstart=0). Please provide the required information there so that I can identify the profile. You can post back here the case id that you will receive after creating the case.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

mrzoidberg2 avatar image
mrzoidberg2 answered
Hi Bangalore, I have created the Case# 172045581 with link to this thread. Thanks for helping.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Sujoy@Amazon avatar image
Sujoy@Amazon answered
This issue was fixed by clearing the device cache. Since device was caching wrong key. If you do not want to factory reset you can also do this to clear the caching and resolve the issue: adb shell pm clear adb shell pm clear com.amazon.device.messaging
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.