0

I've successfully setup my hub to use an SSL certificate per app, but I'd really like to move to the token-based APNs Auth Key approach. I configured my hub with I believe all the right information from the p8 file. For Key ID, I put in the 10-character value from when key was generated. For App ID, I put in my Team ID. For Token, I put in the private key value from the p8 file.

Has anyone had any success with this? Here's what happens when I attempt to send a test message:

When set to sandbox and I do a test send to my device, I get a failed outcome of "The Push Notification System rejected the request because of an invalid credential". When set to production and I do a test send to my device, I get a failed outcome of "The Token obtained from the Token Provider is invalid"

For production, I think that is because I'm sending to a local app build outside of TestFlight/app store, so it is expecting the "development" or sandbox aps-environment.

Not sure what other troubleshooting I can do.

TIA,

kevinsalot
  • 21
  • 4

2 Answers2

1

I figured out what was happening for me.

The App Name field in the Azure Portal is critical to how the message gets delivered. Even though an APNs Auth Key can be used across multiple apps, the notification still must set the topic to be for that particular app. It seems like Azure Notification Hubs take the App Name field and put it into the apns-topic. Once I had that set to my app identifier, it worked as expected.

kevinsalot
  • 21
  • 4
  • Thank you! Using the bundle ID in the "App Name" field was the trick to get it working for me. I also found out that "App ID" == "Team ID" (10 digit string from dev portal). Token is the .p8 file contents without the ---PRIVATE KEY--- prefix and suffix, and with spaces removed. – Erik Villegas Oct 17 '17 at 22:07
0

Also as an FYI, here is the link to the official documentation https://learn.microsoft.com/en-us/azure/notification-hubs/notification-hubs-push-notification-http2-token-authentification

Amol Ravande
  • 146
  • 2