@onboardmobility/firebase
v7.0.0
Published
Firebase auxiliar methods
Downloads
77
Readme
@onboardmobility/firebase
Contains auxiliary methods related to Firebase authentication and notification.
Usage
Authentication
For protectedApi (validate token only)
const protectedApi = require('@onboardmobility/firebase').authentication.firebaseAuth.protectedApi;
const user = await protectedApi(token);
For authorizedApi (valid types {type:''} and modules:[] must be set on Firebase user claims)
const authorizedApi = require('@onboardmobility/firebase').authentication.firebaseAuth.authorizedApi;
const user = await authorizedApi(req.headers.authorization, {
types: [
{ type: 'supervisor'},
],
modules:['CARS']
});
Notification
const firebaseNotification = require('@onboardmobility/firebase').notification.notificationHelper;
await firebaseNotification.sendFirebaseNotification({title: 'title', body: 'body', tokens,});