Custom iOS client Push Notification issue : could not find APNs credentials

I build an ios client with expo client:ios (because I need background location which no more supported in regular client)
I uploaded my .p8 Apple Push Notifications service key as prompted (I got a “:heavy_check_mark: Successfully validated the Push Key you uploaded against Apple Servers” message)

But when trying to send push notification on the server side (to a ExponentPushToken retrieved from this custom iOS client) I get a Exponent::Push::InvalidCredentialsError (Could not find APNs credentials for dev.expo.client.b6knfhxcazlam5rik … ) error message.

APNs key I uploaded is the same I use in production and works well.

Thanks a lot for your help !

hi @romainh, thanks for reporting your issue. This is definitely not expected behavior – I’ll look into this and get back to you!

It would be really helpful if you could send us the build url (ie) expo.io/builds/xxxx-xxxx-xxx, or the client build url (ie) Expo (you should have gotten an email w this link when your build had completed). You can email the links to secure@expo.io . thanks!

I have build & install success custom ios client. Everything seems work fine except push notification.

const { status: existingStatus } = await Permissions.getAsync(Permissions.NOTIFICATIONS)
  if (existingStatus !== 'granted') {
    console.log('existting status', existingStatus)
    // Android remote notification permissions are granted during the app
    // install, so this will only ask on iOS
    const { status } = await Permissions.askAsync(Permissions.NOTIFICATIONS)
    console.log('status', status)
    finalStatus = status
  }

above code result

existting status undetermined
status undetermined

I also uploaded my .p8 Apple Push Notifications service key as prompted (I got a “:heavy_check_mark: Successfully validated the Push Key you uploaded against Apple Servers” message)

I have checked Identifiers in developer portal ( which is auto generated by expo). Push notification have not checked. Is it ok?

Bundle ID
dev.expo.client.ogrbtb6qjs2r2ckysde7kawski6fq7mxgdx7uhy6t5t2g (explicit)

Hello danghung I had the same trouble.
On Apple Developper Portal on the Identifier auto-generated by Expo, if you check “Push Notification” and generate a Certificate you will be able to get a “granted” status from Permissions.askAsync(Permissions.NOTIFICATIONS) and retrieve a ExponentPushToken.
But then I am unable to send a Push Notification from server-side because of this Exponent::Push::InvalidCredentialsError …

On Apple Developper Portal on the Identifier auto-generated by Expo, if you check “Push Notification” and generate a Certificate you will be able to get a “granted” status from Permissions.askAsync(Permissions.NOTIFICATIONS)

Do we need to do it manual?
Because it does not appear in documents.
@quinlanj can you confirm this?

@danghung
oh hm… it looks like the apple developer portal does not automatically enable push notifications :confused:
With the current state of things, in order to get Permissions.NOTIFICATIONS, you will need to check off Push Notifications as @romainh described in the Apple Developer Portal. Next, you will need to build again to get a Client build with the appropriate configurations. This new build should allow you to obtain a token.

Building twice is not the most ideal state, so I’ll also look into automatically enabling push notifications so ppl dont have to manually do this from the developer portal.

Blockquote
Exponent::Push::InvalidCredentialsError (Could not find APNs credentials for dev.expo.client.b6knfhxcazlam5rik … ) error message.

@romainh
Did you solve this problem?

I have the same issue (could not find APNs credentials…).

It seems that the Push Notifications have been enabled automatically for my custom ios client app, but no certificate has been attached (cf screenshot), is it an issue?

Hello @danghung no unfortunately when I try to send push notification I still get a Exponent::Push::InvalidCredentialsError (Could not find APNs credentials for dev.expo.client.b6knfhxcazlam5rik … ) error message …
Do you have any clues about it @quinlanj ? Thanks !

@romainh @quinlanj Do we have any update?

hi @danghung,

we’ve had to disable push notifications temporarily until we complete our work to add an extra authentication layer to the Expo Push Notification service. see:
https://docs.expo.io/versions/latest/guides/adhoc-builds/#push-notifications

with regards to the other issues, i’ve since patched the system so you dont need to manually configure anything in your Apple development portal.

@danghung @romainh @quinlanj I’m facing the same issue , I was able to compile iOS expo Custom client from master branch and able to deploy on my iphone with firebase google ID but again unable to send notifications due to invalid credentials.

I got the below error , do you have time line for the extra authentication layer you wanna add ?

{
“data”: {
“status”: “error”,
“message”: “Could not find APNs credentials for host.exp.test (@atiato78/notify). Check whether you are trying to send a notification to a detached app. If not, you may need to clear your push credentials and regenerate or upload new ones.”,
“details”: {
“error”: “InvalidCredentials”
}
}
}

I did everything at apple developer account from adding push service for app deployed on custom expo client .

Even i tried my custom expo client on android and on android I’m unable to get Expo token. on android the google service json object is being overwwrite automaticlly by the app.

i tried copying google-service.json on android and i was finally able to generate the token but i’m still unable to send notification as below error :slight_smile:

{
“data”: {
“id”: “b67ee133-b760-4639-b2e1-e8be5821c1de”,
“status”: “error”,
“message”: “There was an unknown error with the FCM server. See this error’s details for more information.”,
“details”: {
“fault”: “fcm”,
“fcm”: {
“error”: “MismatchSenderId”
}
}
}
}

@romainh @quinlanj Did the problem solve?

Did the problem solve? :sweat_smile:

I have the same problem. I have tried multiple things and all the recommendations above and I still get the Could not find APNs credentials for ‘xxx’ when trying to send a notification from PHP.
Weirdly enough, the Push Notification Tool — Expo service works just fine!
Did anyone find a solution?