0.1.26 • Published 11 months ago

firebase-auth-setup v0.1.26

Weekly downloads
-
License
-
Repository
github
Last release
11 months ago

Sign-in with Firebase Authentication

You can use this library to easily integrate with Firebase Authorization for your React app.

Installation

npm i firebase-auth-setup

How to use

PS: Before starting please prepare the config file that you can find on your Firebase account page. Copy the content of the firebase config and put it inside .env.local file(first you will be needed to rename the .env.local-sample file to .env.local)

  1. Wrap your app component with FirebaseContext.Provider and pass firebase global object with firebaseConfig. In index.js
import React from "react";
import ReactDOM from "react-dom/client";
import App from "./App";
import {
  FirebaseContext,
  FirebaseStore,
} from "firebase-auth-setup/dist/firebase-setups";

import firebaseConfig from "./firebase-config";

const root = ReactDOM.createRoot(document.getElementById("root"));
root.render(
  <FirebaseContext.Provider value={new FirebaseStore(firebaseConfig)}>
    <App />
  </FirebaseContext.Provider>
);
  1. Import social media buttons from firebase-auth-setup/dist/components
import {
  GoogleLoginButton,
  FacebookLoginButton,
} from "firebase-auth-setup/dist/components";

Use them on your react component:

<GoogleLoginButton
    title="Login with Google"
    onSuccess={onSuccessLogin}
    onFailure={onLoginFailure}
/>
<FacebookLoginButton
    title="Login with Facebook"
    onSuccess={onSuccessLogin}
    onFailure={onLoginFailure}
/>

You can easily predefine props by passing title, onSuccess and onFailure handler. All props are OPTIONAL\ Here:\ title - the label of a button\ onSuccess - your custom function that will be fired after logging in\ onFailure - your custom function which will be fired when something happens during sig-in process\

Demo

We already prepared a demo. Just clone the repo and run:

npm install
npm run start

Where can you reach me?

To stay connected follow me on Github: Serik

0.1.26

11 months ago

0.1.25

11 months ago

0.1.24

11 months ago

0.1.23

11 months ago

0.1.22

11 months ago

0.1.21

11 months ago

0.1.19

11 months ago

0.1.18

11 months ago

0.1.17

11 months ago

0.1.16

11 months ago

0.1.15

11 months ago

0.1.14

11 months ago

0.1.13

11 months ago

0.1.12

11 months ago

0.1.11

11 months ago

0.1.10

11 months ago

0.1.9

11 months ago

0.1.8

11 months ago

0.1.7

11 months ago

0.1.6

11 months ago

0.1.5

11 months ago

0.1.4

11 months ago

0.1.3

11 months ago

0.1.2

11 months ago

0.1.1

11 months ago