useAuthCallback
Handles authentication callback flows for OAuth and email verification.
Automatically parses URL query params and completes authentication or verification.
- Handle redirects after OAuth/email verification.
- Store credentials and verify email after callback.
- Status flags:
email
,provider
,isLoading
,isError
,isSuccess
.
import { useAuthCallback } from "@openfort/react"
function SampleComponent() {
const {
email,
provider,
verifyEmail, // Verify email after user signs up with email.
storeCredentials, // Store credentials after auth callback.
isLoading, // Indicates if the hook is currently loading.
isError, // Indicates if the hook has encountered an error.
isSuccess, // Indicates if the hook has successfully completed.
error, // The error object if an error occurred, otherwise null.
} = useAuthCallback({
enabled, // Whether to automatically handle the callback.
throwOnError, // Whether to throw errors.
onSuccess, // Callback function to execute on success.
onError, // Callback function to execute on error.
onSettled, // Callback function to execute when the operation is settled (either success or error).
})
// ...
}