Login
Sign a user in. With @pollar/react a single prebuilt modal renders every provider you configured — social, email OTP and any wallet adapters. With @pollar/core you drive each provider yourself and read the auth state machine.
openLoginModal() opens the prebuilt modal with every provider; login({ provider }) enters one provider directly, skipping the modal.
openLoginModal() takes no arguments — it renders every configured provider and resolves the session for you.
Hook & values used
All of these come from the usePollar() hook — the react layer built on top of getClient().
usePollar()hookparams: No arguments. Call it at the top level of a component — it reads React context, so it must run during render.
returns: PollarContextValue — the whole SDK surface: reactive state values, modal openers, and getClient() to drop down to core.
openLoginModal()syncparams: No arguments — it renders every configured provider in Pollar's prebuilt modal.
returns: void — opens the prebuilt modal; there is nothing to await.
login(options)syncparams: Same options as core — enter one provider directly (e.g. login({ provider: 'google' })) without opening the modal.
returns: void — progress surfaces through the reactive isAuthenticated / wallet values.
isAuthenticatedreactive valueparams: Not a function — a boolean read from usePollar(). false until the server confirms the session.
returns: Re-renders your component when the session is created or torn down. Pair with verified before gating signing.
import { usePollar } from '@pollar/react'; export function LoginButton() { const { openLoginModal, login, isAuthenticated } = usePollar(); if (isAuthenticated) return null; // openLoginModal renders every provider you configured (social, email, // wallet adapters) in Pollar's prebuilt modal — no UI to build. return ( <> <button onClick={openLoginModal}>Sign in</button> {/* …or skip the modal and enter one provider directly */} <button onClick={() => login({ provider: 'google' })}> Continue with Google </button> </> ); }