useOAuthSignIn
Google, Apple, GitHub, or any provider — popup or redirect.
Works with any Firebase provider — Google, Apple, GitHub, Facebook, Microsoft, X, or a custom OAuthProvider.
import { GoogleAuthProvider } from 'firebase/auth';
const { signIn, loading, error } = useOAuthSignIn({ onIdToken: createSession });
<button onClick={() => signIn(new GoogleAuthProvider())}>Continue with Google</button>;Returns
signIn(provider, opts?) resolves to { success: true, user, credential } or a failure result. Both may be null on the redirect path, where the result arrives on the next page load.
opts.method is "popup" (default) or "redirect".
Both halves of a redirect
Pass method: "redirect" for environments that block popups, such as in-app browsers.
await signIn(new GoogleAuthProvider(), { method: 'redirect' });The hook also completes a pending redirect on mount via getRedirectResult, running the same onIdToken. One hook covers both halves of the round-trip — you don't need a second one on the return page.
Options
Prop
Type