Start with hosted authentication
- Configure the application and copy
auth.jsfrom the JavaScript quickstart. - Route your registered
/auth/callbackto a page that callshandleCallback()once. Guard against duplicate effects, including development effect replay: a code is single-use. - Keep loading, signed-out, signed-in and failed-session states distinct. Show sign-in errors without logging tokens or callback codes.
- Validate every protected request on your backend. Hiding a component is not authorization.
SignInButton.jsx
getSession() after the callback to populate your user view. On sign-out, clear user-specific caches and handle a failed server revocation explicitly. The minimal JavaScript helper does not persist sessions after reload.
React package release preview
The planned@didit-protocol/auth-react package provides a DiditAuth root, useAuth, useUser, SignIn, SignUp, UserButton, SignedIn, SignedOut and ConnectedAgents. Component props, callback routing and package versions must be taken from the published release. Do not assume the verification SDK supplies these components.
Automatic signals and vendorData depend on the Authentication core release. Until then, use your backend’s mapping from the validated sub. See the shared integration prompt for verification and monitoring alongside sign-in.
Test a canceled redirect, double-clicked sign-in, callback refresh, expired session, MFA and logout. Render both loading and error states without showing protected data from a previous user.