react-firebase-google-login
TypeScript icon, indicating that this package has built-in type declarations

1.1.5 • Public • Published

React Firebase Google Login

Install:

npm i react-firebase-google-login firebase

Import to React:

import { useGoogleFireBaseLogin } from "react-firebase-google-login";

Use in React

import React from "react";
import { useGoogleFireBaseLogin } from "react-firebase-google-login"

const GoogleLoginComponent = () => {
    const  firebaseConfig: = {
      apiKey: "YOUR_API_KEY",
      authDomain: "YOUR_AUTH_DOMAIN",
      projectId: "YOUR_PROJECT_ID",
      messagingSenderId: "YOUR_MESSAGING_SENDER_ID",
      appId: "YOUR_APP_ID",
      measurementId: "YOUR_MEASUREMENT_ID"
    }
    const scope = ["https://www.googleapis.com/auth/firebase","add more auth"] // See more at : https://developers.google.com/identity/protocols/oauth2/scopes?hl=en
  const { response, handleSignInGoogle, isError } = useGoogleFireBaseLogin({
    firebaseConfig
    scope
  });
  console.log(response)
  return (
    <div>
      <button onClick={handleSignInGoogle}>Login with Google</button>

    </div>
  );
};

export default GoogleLoginComponent;

Props:

firebaseConfig : A firebase config

Scope : List scope for google auth at : https://developers.google.com/identity/protocols/oauth2/scopes?hl=en

Author

Copyright 2024 mia nguyen x thind9xdev

Licensed under the MIT License

Package Sidebar

Install

npm i react-firebase-google-login

Weekly Downloads

3

Version

1.1.5

License

MIT

Unpacked Size

10.4 kB

Total Files

6

Last publish

Collaborators

  • thind9xdev