Skip to content

Latest commit

 

History

History
64 lines (48 loc) · 1.69 KB

README.md

File metadata and controls

64 lines (48 loc) · 1.69 KB

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