29

Usually there are 3 info I need to provide, to use Apple APNs: key, keyId, teamId, like here.

I understand key (pem file location) and teamId, but where do I find keyId? Is this somewhere in https://developer.apple.com ? Is this the bundle ID?

enter image description here

János
  • 32,867
  • 38
  • 193
  • 353

3 Answers3

41
key: 'apns.p8',   // Path to the key p8 file
keyId: 'ABCDE12345', // The Key ID of the p8 file (available at https://developer.apple.com/account/ios/authkey/)
teamId: 'ABCDE12345', // The Team ID of your Apple Developer Account (available at https://developer.apple.com/account/#/membership/)

You can find more on : https://eladnava.com/send-push-notifications-to-ios-devices-using-xcode-8-and-swift-3/

Dheeraj Singh
  • 5,143
  • 25
  • 33
  • Thanks, useful tutorial, any idea how should I change configuration not to get 403 error when sending notification to APNs? http://stackoverflow.com/questions/40653808/invalidprovidertoken-403-response – János Nov 17 '16 at 11:35
  • @János The APN 403 is somewhat ambiguous. I'm on the same wild goose chase myself. Best way to find the solution is just keep trying new things until you figure it out. If I find a solution before you do I'll post back here. – Jacksonkr Mar 03 '17 at 18:14
  • @DheerajSingh Excellent detail by the way. Thanks for posting links to where I could find ID info. +1 – Jacksonkr Mar 03 '17 at 18:15
  • 1
    this link is not valid now i think. https://developer.apple.com/account/ios/certificate/key . Instead the @kelin ' s link seems right https://developer.apple.com/account/ios/authkey – webenformasyon Apr 23 '18 at 08:19
  • @webenformasyon Yeah the link has updated, thanks for pointing out. Updated the answer. – Dheeraj Singh Apr 24 '18 at 18:36
  • @webenformasyo https://developer.apple.com/account/ios/authkey also not working. It is redirect to https://developer.apple.com/account/resources/certificates/list – Dinuka Thilanga Jul 01 '20 at 08:24
  • this no longer works in 2020, with Apple now downloading .cer file and having no way to see the key ID. – Anuj Pandey Jul 04 '20 at 03:06
10

If one don't have Key ID at https://developer.apple.com/account/ios/authkey, he or she can follow this steps to create it:

1) Go to Developer Account aka Member Center > Certificates, IDs & Profiles > Keys / All > press the "+" enter image description here

2) Enter Name and check APNs. The key is the same among your apps, so don't add app name to the key name. Click Confirm. enter image description here

3) Download the key and be careful with it. Here you can see the Key ID (kid) value. enter image description here

kelin
  • 11,323
  • 6
  • 67
  • 104
  • 1
    developer.apple.com/account/ios/authkey also not working. It is redirect to developer.apple.com/account/resources/certificates/list – Dinuka Thilanga Jul 01 '20 at 08:25
10

Key ID can also be derived from the name of the file for the key. Your file with the key will probably be named something like: AuthKey_ABC1DEF11G.p8, so ABC1DEF11G is the key ID.

Team ID can be found on the Apple account webpage (upper right corner).