firebase / firebase-admin-node

Firebase Admin Node.js SDK
https://firebase.google.com/docs/admin/setup
Apache License 2.0
1.64k stars 372 forks source link

[FR] Allow to upload APNs auth keys to Firebase #2204

Open Kampfmoehre opened 1 year ago

Kampfmoehre commented 1 year ago

Is your feature request related to a problem? Please describe. We are trying to automate Firebase app creation since we manage many apps and most of them need push notifications. I played around with the Firebase admin SDK and got the most stuff working somehow, but I can't figure out how to upload the APNs auth key to Firebase. Is there and official way to do this via this SDK or via Rest API?

Describe the solution you'd like I would like to have an SDK method or rest API endpoint where I can upload an Apple Push Notification service authentication key to Firebase so we can send push notifications to iOS apps managed in Firebase.

Describe alternatives you've considered The alternative to having a method in the SDK would be at least a rest API endpoint.

Additional context Funnily in my desperation I asked ChatGPT how it would solve this and it generated this code:

const messaging = admin.messaging(app);
const apnsKey = {
  authKey: '/path/to/AuthKey_XXXXXXXX.p8',
  keyId: 'XXXXXXXX',
  teamId: 'XXXXXXXX',
};

messaging.setApnsCredential(credential, apnsKey);

But I looked around the repo (even in older revisions) and could not find any method like this. Was there any and if yes, when and why was it removed?

Aulig commented 1 year ago

As far as I know there's no official API function for this - I've been waiting on it for years aswell.