React-redux-firebase: feat(integration): firebase-admin integration

Created on 31 Dec 2016  路  5Comments  路  Source: prescottprue/react-redux-firebase

Most helpful comment

It is not currently supported, but I will add this to the roadmap. Open to pull requests for this, but if not it should still be added soon.

Thanks for the suggestion!

All 5 comments

It is not currently supported, but I will add this to the roadmap. Open to pull requests for this, but if not it should still be added soon.

Thanks for the suggestion!

Do you have ideas for how you would like to interact with the API?

Maybe something like this:

this.props.firebase.admin().getUser()
this.props.firebase.admin().createUser()

Also, it will most likely require passing in an instance of firebase-admin that has already been initialized so that it does not have to be a dependency like so:

import * as admin from 'firebase-admin'
const serviceAccount = require("path/to/serviceAccountKey.json");

admin.initializeApp({
  credential: admin.credential.cert(serviceAccount),
  databaseURL: "https://<DATABASE_NAME>.firebaseio.com"
});

// Firebase config
const fbConfig = {
 apiKey: '<your-api-key>',
 authDomain: '<your-auth-domain>',
 databaseURL: '<your-database-url>',
 storageBucket: '<your-storage-bucket>'
}

// React Redux Firebase Config
const config = {
  userProfile: 'users',
  admin // pass instance of admin as admin parameter
}

// Add react-redux-firebase to compose
const createStoreWithFirebase = compose(
 reactReduxFirebase(fbConfig, config),
)(createStore)

I think most use cases do not involve usage of firebase-admin so keeping from adding it as a dependency would be ideal (hence passing of the initialized instance).

Api looks great. 馃憤

I think most use cases do not involve usage of firebase-admin so keeping from adding it as a dependency would be ideal (hence passing of the initialized instance).

I agree.

This should work on v2 (install with npm i --save react-redux-firebase@canary).

NOTE: firebase-admin can not be used without some things from the nodejs environment including modules like fs. That means it will most likely not work in front end applications without some config changes and IS NOT SUGGESTED (since service account has to be exposed).

Going to close since it is now supported.

Was this page helpful?
0 / 5 - 0 ratings