react-gapi-auth2
Version:
React bindings for gapi.auth2 (Google's OAuth 2.0 JavaScript client)
37 lines (36 loc) • 1.34 kB
TypeScript
/// <reference types="gapi.auth2" />
import { FC, ReactNode } from "react";
export declare type GApiProps = {
children: ReactNode;
/**
* Config passed to `gapi.auth2.init`: {@link https://developers.google.com/identity/sign-in/web/reference#gapiauth2initparams}
*/
clientConfig: gapi.auth2.ClientConfig;
};
export declare type GApiValue = {
/**
* Config passed to `gapi.auth2.init`: {@link https://developers.google.com/identity/sign-in/web/reference#gapiauth2initparams}
*/
clientConfig: gapi.auth2.ClientConfig;
/**
* Boolean flag indicating that the `gapi.auth2` library has loaded
*/
isAuth2Loaded: boolean;
/**
* Boolean flag indicating that the `gapi` object has loaded
*/
isPlatformLoaded: boolean;
/**
* Any error from initializing `gapi` libraries
*/
error: Error | null;
};
export declare const useGApiContext: () => GApiValue | null;
/**
* Loads the necessary `gapi` libraries. This is simply a wrapper for the
* various `Auth Setup` methods described here: {@link https://developers.google.com/identity/sign-in/web/reference#auth_setup}
*
* You must wrap your application with `GApiProvider` to use any of
* the hooks (`useAuthentication`, `useUsers` and `useAuthroize`).
*/
export declare const GApiProvider: FC<GApiProps>;