API reference
useThunderID()The
useThunderID hook provides access to the ThunderID authentication context in React applications. It allows you to retrieve authentication state, user information, and other context values managed by the ThunderIDProvider.isSignedInbooleanWhether the user is currently signed in
userUser \The authenticated user object, or `null` if not signed in
signIn() => PromiseInitiates the sign-in flow
signOut() => PromiseInitiates the sign-out flow
loadingbooleanIndicates if an authentication operation is in progress
errorError \The last error encountered during authentication, if any
import { useThunderID } from '@thunderid/react'
function MyComponent() {
const { isSignedIn, user, signIn, signOut } = useThunderID()
return (
<div>
{isSignedIn ? (
<>
<p>Welcome, {user?.displayName}!</p>
<button onClick={() => signOut()}>Sign Out</button>
</>
) : (
<button onClick={() => signIn()}>Sign In</button>
)}
</div>
)
}
export default MyComponentGet started
Provider, session, and a protected route, start to finish.
Connect your application
~5 minGetting started / Connect your application / React
The quickstart is maintained alongside the rest of the getting-started guides so it stays in step with the platform. This page covers the package itself: its API surface, guides, and compatibility.
Guides
Task-focused walkthroughs maintained alongside the SDK.