Firebase FCM Auth Tokens
Automatically store FCM Tokens for Firebase Auth Users in Cloud Firestore.
This library is a proof of concept, and very much a work in progress.
Installation
Firebase FCM Auth Tokens requires Firebase v5.0.0 or later.
npm install --save firebase-fcm-auth-tokens
Usage
// These Firebase libraries need to be enabled
import firebase from 'firebase/app';
import 'firebase/auth';
import 'firebase/firestore';
import 'firebase/messaging';
// Import this library
import fcmTokenSubscriber from 'firebase-fcm-auth-tokens';
// Subscribe a Firebase App and store FCM tokens in the `user-fcm-tokens` collection in Firestore
const unsubscribe = fcmTokenSubscriber(firebase.app(), 'user-fcm-tokens');
// Unsubscribe
unsubscribe();
Documentation
API
TODO
Security rules
TODO