Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Solved
  • Unsolved
  • Users
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (Darkly)
  • No Skin
Collapse
brainCloud Forums
  1. Home
  2. APIs
  3. 'INVALID_TOKEN' When Sending Push Notifications

'INVALID_TOKEN' When Sending Push Notifications

Scheduled Pinned Locked Moved Solved APIs
iospush notifications
24 Posts 5 Posters 17.6k Views 5 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Joseph Wiemer

    @Paul-Winterhalder I'm getting "The credentials supplied to the package were not recognized." No clue what that means, unfortunately.

    Paul WinterhalderP Offline
    Paul WinterhalderP Offline
    Paul Winterhalder
    brainCloudAdmin
    wrote on last edited by
    #8

    @Joseph-Wiemer My guess would be bad password?

    J 1 Reply Last reply
    0
    • Paul WinterhalderP Paul Winterhalder

      @Joseph-Wiemer My guess would be bad password?

      J Offline
      J Offline
      Joseph Wiemer
      wrote on last edited by
      #9

      @Paul-Winterhalder That's what I thought at first, but no, my password is correct.

      1 Reply Last reply
      0
      • Paul WinterhalderP Offline
        Paul WinterhalderP Offline
        Paul Winterhalder
        brainCloudAdmin
        wrote on last edited by
        #10

        I agree with Jonathan's suggestion to recreate the P12 file. I'm reading several articles here where someone was getting the same error.

        The solution in all cases was to recreate the P12 file.

        The quote from the discussion:

        I figured out the problem. I revoked and regenerated the certificate again, and this time I only exported the private key (without the certificate). In Keychain access, I exported as .p12 and used the new file and it worked. For some reason, PushSharp wasn't play well with .p12 when both certificate and private key are present in the file.

        Here's the link to Stack Overflow:
        https://stackoverflow.com/questions/23329040/pushsharp-apns-production-the-credentials-supplied-to-the-package-were-not-reco

        Hope that helps!

        Paul.

        J 2 Replies Last reply
        1
        • Paul WinterhalderP Paul Winterhalder

          I agree with Jonathan's suggestion to recreate the P12 file. I'm reading several articles here where someone was getting the same error.

          The solution in all cases was to recreate the P12 file.

          The quote from the discussion:

          I figured out the problem. I revoked and regenerated the certificate again, and this time I only exported the private key (without the certificate). In Keychain access, I exported as .p12 and used the new file and it worked. For some reason, PushSharp wasn't play well with .p12 when both certificate and private key are present in the file.

          Here's the link to Stack Overflow:
          https://stackoverflow.com/questions/23329040/pushsharp-apns-production-the-credentials-supplied-to-the-package-were-not-reco

          Hope that helps!

          Paul.

          J Offline
          J Offline
          Joseph Wiemer
          wrote on last edited by
          #11

          @Paul-Winterhalder That gives me something to pursue. Thanks, Paul!

          1 Reply Last reply
          0
          • Paul WinterhalderP Paul Winterhalder

            I agree with Jonathan's suggestion to recreate the P12 file. I'm reading several articles here where someone was getting the same error.

            The solution in all cases was to recreate the P12 file.

            The quote from the discussion:

            I figured out the problem. I revoked and regenerated the certificate again, and this time I only exported the private key (without the certificate). In Keychain access, I exported as .p12 and used the new file and it worked. For some reason, PushSharp wasn't play well with .p12 when both certificate and private key are present in the file.

            Here's the link to Stack Overflow:
            https://stackoverflow.com/questions/23329040/pushsharp-apns-production-the-credentials-supplied-to-the-package-were-not-reco

            Hope that helps!

            Paul.

            J Offline
            J Offline
            Joseph Wiemer
            wrote on last edited by
            #12

            @Paul-Winterhalder I exported just the private key without the cert and pushtry.com now says, "Push notification sent successfully". So, I uploaded this new .p12 file to brainCloud. However, I never actually received a notification on my device, and am still unable to send notifications via the brainCloud dashboard.

            Steve JonesS 1 Reply Last reply
            0
            • Paul WinterhalderP Offline
              Paul WinterhalderP Offline
              Paul Winterhalder
              brainCloudAdmin
              wrote on last edited by
              #13

              Okay - the two symptoms:

              #1 - You say you never got that push from the pushtry tool. I assume your app wasn't running at the time? Apple hides push notifications from apps if the app is currently running. Try again?

              #2 - When you say you can't send notifications, you mean they aren't received - just like #1, correct?

              Talking to one of our devs now. He mentions that you need to ensure that the app that's running on the device is built with the correct "entitlements". He's gonna provide more info...

              Stay tuned...

              Paul.

              J 1 Reply Last reply
              0
              • J Joseph Wiemer

                @Paul-Winterhalder I exported just the private key without the cert and pushtry.com now says, "Push notification sent successfully". So, I uploaded this new .p12 file to brainCloud. However, I never actually received a notification on my device, and am still unable to send notifications via the brainCloud dashboard.

                Steve JonesS Offline
                Steve JonesS Offline
                Steve Jones
                brainCloudAdmin
                wrote on last edited by Steve Jones
                #14

                @Joseph-Wiemer

                Can you confirm that the cert that you made was for Production? AND! that the apps entitlement was set correctly.

                https://developer.apple.com/documentation/bundleresources/entitlements/aps-environment https://developer.apple.com/documentation/usernotifications/registering_your_app_with_apns

                By default when building from xcode, the default Push Notification Entitlement is development, ensure this is set to production.

                Have you confirmed you received the Push notification from pushtry.com on your device ?

                -= Steve Jones =-

                J 1 Reply Last reply
                0
                • Paul WinterhalderP Offline
                  Paul WinterhalderP Offline
                  Paul Winterhalder
                  brainCloudAdmin
                  wrote on last edited by
                  #15

                  And note, if you change the entitlement, after rebuilding, you'll need to re-run the app on your device - which I believe will cause it to register a new, updated device token... You'll want to use that one for your tests...

                  Do I have that right Steve?

                  1 Reply Last reply
                  0
                  • Steve JonesS Offline
                    Steve JonesS Offline
                    Steve Jones
                    brainCloudAdmin
                    wrote on last edited by
                    #16

                    Correct! @Paul-Winterhalder Keep us updated @Joseph-Wiemer

                    -= Steve Jones =-

                    1 Reply Last reply
                    0
                    • Paul WinterhalderP Paul Winterhalder

                      Okay - the two symptoms:

                      #1 - You say you never got that push from the pushtry tool. I assume your app wasn't running at the time? Apple hides push notifications from apps if the app is currently running. Try again?

                      #2 - When you say you can't send notifications, you mean they aren't received - just like #1, correct?

                      Talking to one of our devs now. He mentions that you need to ensure that the app that's running on the device is built with the correct "entitlements". He's gonna provide more info...

                      Stay tuned...

                      Paul.

                      J Offline
                      J Offline
                      Joseph Wiemer
                      wrote on last edited by
                      #17

                      @Paul-Winterhalder

                      #1 - My app was not running at the time, and I tried again.
                      #2 - That's correct. And I'm still getting the same INVALID_TOKEN error in "Recent Errors".

                      My app does have the correct "production" entitlement, yes.

                      1 Reply Last reply
                      0
                      • Steve JonesS Steve Jones

                        @Joseph-Wiemer

                        Can you confirm that the cert that you made was for Production? AND! that the apps entitlement was set correctly.

                        https://developer.apple.com/documentation/bundleresources/entitlements/aps-environment https://developer.apple.com/documentation/usernotifications/registering_your_app_with_apns

                        By default when building from xcode, the default Push Notification Entitlement is development, ensure this is set to production.

                        Have you confirmed you received the Push notification from pushtry.com on your device ?

                        J Offline
                        J Offline
                        Joseph Wiemer
                        wrote on last edited by
                        #18

                        @Steve-Jones Yes to both. My cert is for distribution and my app entitlement is set to "production". No, the notification from pushtry.com never appeared on my device, despite the service claiming to have been successful.

                        1 Reply Last reply
                        0
                        • Paul WinterhalderP Offline
                          Paul WinterhalderP Offline
                          Paul Winterhalder
                          brainCloudAdmin
                          wrote on last edited by
                          #19

                          Dumb question - do you have any other devices that you can load your app on and try with? It's certainly suspicious that pushtry isn't working for you.

                          At this point I'd be removing the app from the device, re-installing, re-running (to register what I believe would be a new device token), and retrying the send - both from pushtry and brainCloud.

                          If both pushtry and brainCloud don't work - the common denominators are your app's configuration, the device itself, and Apple's servers...

                          J 1 Reply Last reply
                          0
                          • Paul WinterhalderP Paul Winterhalder

                            Dumb question - do you have any other devices that you can load your app on and try with? It's certainly suspicious that pushtry isn't working for you.

                            At this point I'd be removing the app from the device, re-installing, re-running (to register what I believe would be a new device token), and retrying the send - both from pushtry and brainCloud.

                            If both pushtry and brainCloud don't work - the common denominators are your app's configuration, the device itself, and Apple's servers...

                            J Offline
                            J Offline
                            Joseph Wiemer
                            wrote on last edited by
                            #20

                            @Paul-Winterhalder Yes, I do have other devices I could try. I realize this probably isn't a brainCloud problem, so I appreciate all the help you guys have given me, here. Thank you, and I'll keep trying to figure it out.

                            Paul WinterhalderP 1 Reply Last reply
                            0
                            • J Joseph Wiemer

                              @Paul-Winterhalder Yes, I do have other devices I could try. I realize this probably isn't a brainCloud problem, so I appreciate all the help you guys have given me, here. Thank you, and I'll keep trying to figure it out.

                              Paul WinterhalderP Offline
                              Paul WinterhalderP Offline
                              Paul Winterhalder
                              brainCloudAdmin
                              wrote on last edited by Paul Winterhalder
                              #21

                              @Joseph-Wiemer No worries - good luck! And keep us posted! 🙂

                              1 Reply Last reply
                              0
                              • J Offline
                                J Offline
                                Joseph Wiemer
                                wrote on last edited by
                                #22

                                Ok guys, I've solved it! It was some godforsaken problem with my .p12 file.

                                1. Tried creating a .p12 file by exporting both the private key and the cert. FAILED.
                                2. Tried creating a .p12 file by exporting just the private key. FAILED.
                                3. Tried creating a .p12 file by exporting just the cert. SUCCESS.

                                So, notifications are now working for me. Not sure how to mark this question as solved, but it's solved. Thanks for all your help!

                                1 Reply Last reply
                                1
                                • Paul WinterhalderP Offline
                                  Paul WinterhalderP Offline
                                  Paul Winterhalder
                                  brainCloudAdmin
                                  wrote on last edited by
                                  #23

                                  Awesome - glad to hear it!

                                  I'll mark it resolved for you.

                                  Cheers!

                                  Paul.

                                  1 Reply Last reply
                                  0
                                  • Simon LavigneS Offline
                                    Simon LavigneS Offline
                                    Simon Lavigne
                                    wrote on last edited by
                                    #24

                                    I just got our iOS Push Notifications working with brainCloud and would like to add a few tips to this thread.

                                    1. For the less Mac-Savvy developers like me, here's what it looks like when you only have your certificate with no private key to export as a P12 file:

                                    Screen Shot 2019-06-19 at 4.02.20 PM.png

                                    Notice the selected category is [My Certificates]. Certificates in the [Certificates] category have the P12 export option greyed out.

                                    1. I am using Unity as a development platform and for some reason my device would only receive Development Push Notifications even when running in Release in Xcode. It's only after uploading to TestFlight that my Production Push Notifications started working.
                                    1 Reply Last reply
                                    1

                                    Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                                    Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                                    With your input, this post could be even better 💗

                                    Register Login
                                    Reply
                                    • Reply as topic
                                    Log in to reply
                                    • Oldest to Newest
                                    • Newest to Oldest
                                    • Most Votes


                                    • Login

                                    • Login or register to search.
                                    • First post
                                      Last post
                                    0
                                    • Categories
                                    • Recent
                                    • Tags
                                    • Popular
                                    • Solved
                                    • Unsolved
                                    • Users