Skip to content

aymendhaya/ra-auth-firebase-client

Repository files navigation

ra-auth-firebase-client

NPM JavaScript Style Guide

Requirements

npm install firebase

Install

npm install --save ra-auth-firebase-client

Usage

import { Admin, Resource } from 'react-admin'
import {emailAndPasswordAuthProvider} from "ra-auth-firebase-client";
import { PostList, PostEdit, PostCreate } from './Posts'

import dataProvider from 'your-data-provider';
import firebase from 'firebase/app'
import 'firebase/auth'

firebase.initializeApp({
  apiKey: '**************',
  authDomain: '**************',
  databaseURL: 'https://myrealtimedatabase.firebaseio.com',
  projectId: 'myrealtimedatabase',
  storageBucket: 'myrealtimedatabase.appspot.com',
  messagingSenderId: '**************',
  appId: '**************',,
  measurementId: '**************'
})

export default () =>
  <Admin authProvider={emailAndPasswordAuthProvider(firebase)} dataProvider={dataProvider} >
    <Resource name='posts' list={PostList} edit={PostEdit} create={PostCreate} />
  </Admin>

Result

console.log(localStorage.getItem("user"))

Demo

https://aymendhaya.github.io/ra-auth-firebase-client

Notice

- this is a basic migration to v3

- a lot of functionalities will be added soon

- please feel free to suggest new functionnalities

About dataProvider

Firebase dataProvider is a separate project. Check ra-data-firebase-client

Releases

No releases published

Packages

No packages published