I am using the google firebase admin sdk and have followed the instructions to set it up. I am sending messages and notifications via FCM and this was working no problem but recently I noticed that our metrics were showing no notifications being sent to client devices.
Took a look at the Node.js output and am seeing:
errorInfo:
{ code: 'messaging/invalid-apns-credentials',
message: 'Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.' },
codePrefix: 'messaging' }
Keep in mind the credentials file I was using originally was working and nothing has changed in the environment.
Looking at the docs there is nothing about token expiration or handling auth of any kind beyond providing the json file that firebase admin sdk asks to start with:
var admin = require("firebase-admin");
var serviceAccount = require("path/to/serviceAccountKey.json");
admin.initializeApp({
credential: admin.credential.cert(serviceAccount),
databaseURL: "https://my-app-id.firebaseio.com"
});
If I log into the firebase console and check the service account I can see it and the only option I have is to generate a new private key (big blue button).
Is there something I should be doing to allow the credentials to remain in effect? Renewing a token or something? Nowhere in the FCM setup docs does it mention that and it seems to imply that nothing of that nature is required if you use the official firebase admin sdk. Here is the guide I followed: https://firebase.google.com/docs/admin/setup
Can anyone weigh in on if I need to add some extra code to catch when a cert expires and renew?
Thanks!