Skip to content

React useGSI hook for interacting with Google Identity Service API

License

Notifications You must be signed in to change notification settings

esteticalVE/useGSI

Repository files navigation

useGSI

Introduction

A tiny React hook that simplifies the process of using the Google Identity Service in a React application

Install

npm

npm install use-gsi

yarn

yarn add use-gsi

Quick Start

Auto initilized google button

Get your Google API client ID

import React from "react";
import { useGSI } from "use-gsi";

export default function App() {
  const [data, setData] = useState({});

  const { buttonRef } = useGSI({
    initializeConfig: {
      //Google API client ID
      client_id: clientId,
      callback: (response) => setData(response),
    },
    method: "renderButton",
    buttonConfig: {
      theme: "outline",
      type: "standard",
    },
  });

  console.log(data);

  return <div ref={buttonRef} />;
}

Options

// TODO

License

The MIT License.

About

React useGSI hook for interacting with Google Identity Service API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages