2
votes

Need to register an endpoint with Amazon SNS when a user agrees to accept Push Notificaitons. Have the registration id I need to send to SNS. When I enter it manually I can send push notifications to my device.

Just need to register the endpoint with SNS using the Amazon API using a Post or Get request automatically when the user agrees to accept push notifications. Right now I'm getting SignatureDoesNotMatch trying to call CreatePlatformEndpoint.

http://docs.aws.amazon.com/sns/latest/api/API_CreatePlatformEndpoint.html

I have my

  • Application ARN
  • Access Key Id
  • Secret Access Key

But I'm not sure what values need to be passed in. Nothing seems to work and I haven't found good examples of what values the API is looking for when I call CreatePlatformEndpoint

It also appears I may need to call this before but this has even more values I'm not sure of.

http://docs.aws.amazon.com/sns/latest/api/API_CreatePlatformApplication.html

Seems like it should be fairly simple to make a request to add an Endpoint to my app. If anyone could help define what data goes where in this request that would be great.

Thanks

1
What language are you using? In my experience using PHP, you typically have to instantiate an authenticated handler for the command you want to run which contains the credentials. You can then use that handler to send the command. - user1832464
And that sounds right I believe you have to use CreatePlatformApplication to get the credentials then CreatePlatformEndpoint to execute the command. - Jason
The Signature I'm sending...that's the private key? And I encode it using the Signature Method specified? - Jason

1 Answers

1
votes

Permissions for the JavaScript SDK are tricky as it's obviously client side which makes your application potentially very susceptible. There's a good overview of JS credential management here. Hardcoding is not advised and if used should only be of a user with read-only credentials. Obviously for this application you need SNS modification permissions for I'd say go down the federation route.

The access key ID can be thought of like a username, and the secret access key is like the password. You need both for an authenticated handler to an AWS resource. The ARN is the thing you want access to and in this case I'm guessing this is the PlatformApplication?

It sounds like your error is because your request isn't being authenticated with the appropriate credentials. Are you also aware if those credentials provide access to the SNS service to make changes?

CreatePlatformApplication will return an ARN to use when creating the Endpoint. The endpoint parameters appear to be looking for that, the token to identify the app on the device, your user data and any other attributes you want to set.