Firebase FCM get tokens for old iOS APNS tokens - ios

With the change of GCM to FCM through Google, we are looking to bring our push notifications for iOS into FCM as well. Without providing an update, which would register each user to the Firebase push service, is it possible to subscribe all current users tokens to the firebase service, therefore generating FCM keys for them?

Yes, you can use the batchImport method of the InstanceID API to import a list of APNs tokens which will return a mapping of InstanceID tokens that you can then use to send messages to iOS app instances using FCM.

Related

What's the difference : FCM Token / APNs Token / Registration Token / Device Token

First, sorry for my English.
I'm trying to send a message to my iOS device using Firebase Cloud Messaging.
However, there are several tokens with different names.
What do these tokens do? What is the difference?
Is FCM token the same as registration token and APNs token the same as device token?
And how can FCM token be made with APNs token?
There are two definitives here:
APNS Token is the Apple Push Notification Service token. It is a token (think of it like a password) that authenticates your app and device onto the Apple Push service and allows for communications to be sent.
FCM Token is the Firebase Cloud Messaging token. This is googles version of the APNS Token however works for both iOS and Android (Google do proxying on their end when sending a push notification to iOS devices).
When you refer to a registration token or a device token it really does depend on the context you use the phrases. They are often used interchangeably and neither are really "official" terms. For the most part, both terms refer to your APNS/FCM token, however device token has historically been used for other things like unique device identifiers.

React Native FCM token not accepted as device token in amazon SNS

I am trying to implement amazon SNS in my react native app using Firebase Cloud Messaging (FCM). For this, i have integrated the react-native-firebase library. With this library i can retrieve my FCM receiver ID which i need to use for SNS to create endpoints. However, when i enter that Registration ID of firebase into Amazon SNS it says that it is not valid due to not being hexadecimal.
Does anyone know how to retrieve the hexadecimal token or how to convert my token to hexadecimal in javascript?
The format of my current Registration ID is
dL2CjuuXskpqlcNLoiPqBC:APA91bFgvmNwRFpy4SA0XDtZig4cwFMLDdBy5Ab9-
AW2LKuE0lZW34tyCBgwwnXbUlVyvIsApAODtQnybjQlq2L10oqoDC-wbR160od_j2wJO23yy65NM1-
xxxxxxxxxxxxxxxxxxxx
Thanks in advance.

How do I upload an iOS APNs auth token to Firebase with the REST API or SDK?

Is there a way to set up Firebase Cloud Messaging (FCM) for iOS apps using the REST API or SDK?
The current (v1beta) API provides functionality to add apps to a project, and download the GoogleService-Info.plist file, but does not appear to provide any way to upload the APNs Auth token that is needed to enable FCM.
Background:
I manage ~100 iOS apps which use Firebase Cloud Messaging. At the moment I need to manually upload the APNs Auth token for each app using the Firebase console. This needs to be done once when the app is set up, and routinely when the auth token expires. I'm looking for a way to automate this with a script, preferably an unattended CI, so that I don't need to do it manually.

Offline logout with FCM service?

There are two types of notification messages public and private. Public messages can be seen by anybody who is using this application. Private messages are meant to be seen by only one user. These private messages may contain some confidential information.
While implementing this scenario on iOS. The FCM token for the device is per application instance ( i.e. on app re-install user may get the new fcm token).
Let's say user A logs out. Now, As the server has his device associated with an fcm token server may send some private information.
Few suggestions are to break the association of token with user session by having logout API. But then what about offline logout? Why isn't there any association of user session with FCM token? How can we handle it in offline log-out with no private push message delivery?
Questions reviewed already :
How to refresh FCM Token on user Logout?

How to get push token for a specific registered user in Firebase [duplicate]

Is there a difference between the firebase.auth().getToken() and the FCM registration token returned via Android setup: FirebaseInstanceId.getInstance().getToken()? I am currently using https://www.npmjs.com/package/firebase which uses the first method above to setup auth as well as generate a token. Using that token when trying to send a notification returns: error:InvalidRegistration...
The Auth and FCM tokens are different and unrelated.
The Firebase Authentication ID token identifies the user. A Firebase Authentication access token (auto-generated based on the ID token) grants the user temporary access to the Firebase back-end.
Firebase FirebaseInstanceId token (that is used by Firebase Cloud Messaging) identifies the installation of the app on a specific device.
For example: if you sign in to an app on two different devices, you will get the same authentication UID (although the access token will be different, each time you sign in on a device).
If you have the same app on two devices, the FCM token will be different. But if the app has sign-in functionality, the FCM token will be the same no matter who (or even if) a user is signed in or not. Furthermore: if a different user signs in to the same installed app, the FCM token will remain unchanged.

Resources