Skip to main content

methods/google/react

React client for the Google sign-in method, exported at @convex-dev/auth/methods/google/react.

useSignInWithGoogle starts the sign-in. useOauth returns the state that is shared by all the OAuth methods, for example the error of the last flow.

const { signIn } = useSignInWithGoogle(api.auth);
const { flowError } = useOauth();

Type Aliases​

UseSignInWithGoogleReturn​

type UseSignInWithGoogleReturn = object;

What useSignInWithGoogle returns.

Properties​

PropertyTypeDescription
signInUseOauthSignInReturn["signIn"]Start Google's OAuth flow. See UseOauthSignInReturn.signIn.

Functions​

useSignInWithGoogle()​

function useSignInWithGoogle(api): UseSignInWithGoogleReturn;

Sign in with Google. Pass the module exporting the functions of the method (usually the generated api.auth), or an object mapping the canonical keys to renamed exports.

Parameters​

ParameterType
api{ completeSignInWithGoogle: FunctionReference<"mutation", "public", { code: string; state: string; }, ClientView< | { status: "complete"; tokens: { accessToken: string; refreshToken: string; refreshTokenExpiresAt: number; userId: string; }; } | { status: "error"; userError: { error: "INVALID_CODE"; }; }>>; startSignInWithGoogle: FunctionReference<"mutation", "public", { redirectTo: string; }, { redirect: string; state: string; }>; }
api.completeSignInWithGoogleFunctionReference<"mutation", "public", { code: string; state: string; }, ClientView< | { status: "complete"; tokens: { accessToken: string; refreshToken: string; refreshTokenExpiresAt: number; userId: string; }; } | { status: "error"; userError: { error: "INVALID_CODE"; }; }>>
api.startSignInWithGoogleFunctionReference<"mutation", "public", { redirectTo: string; }, { redirect: string; state: string; }>

Returns​

UseSignInWithGoogleReturn

References​

OauthCompleteResult​

Re-exports OauthCompleteResult


OauthFlowError​

Re-exports OauthFlowError


OauthStartResult​

Re-exports OauthStartResult


SignInOptions​

Re-exports SignInOptions


useOauth​

Re-exports useOauth


UseOauthReturn​

Re-exports UseOauthReturn