Components
<RedirectToSignUp />
The <RedirectToSignUp /> component ensures users are redirected to the sign-up page if they are not authenticated. If the user is signed in, it does nothing. It's useful for protected pages in your application, specifically when you want unauthenticated users to immediately register instead of logging in.
Installation
pnpm dlx shadcn@latest add https://stackproviders.github.io/better-auth-ui/r/auth.jsonnpx shadcn@latest add https://stackproviders.github.io/better-auth-ui/r/auth.jsonyarn dlx shadcn@latest add https://stackproviders.github.io/better-auth-ui/r/auth.jsonbun x shadcn@latest add https://stackproviders.github.io/better-auth-ui/r/auth.jsonUsage
import { RedirectToSignUp, SignedIn } from "@/components/auth"
export default function ProtectedPage() {
return (
<>
<RedirectToSignUp />
<SignedIn>
Welcome! You are signed in.
</SignedIn>
</div>
)
}