Authentication Workflow

A shared folder with AI prompts and code snippets

From workspace: Bolt

Team: Main

Total snippets: 6

Bolt

Authentication Workflow

6 snippets

Add Auth Loading State

Display a spinner or skeleton UI while checking authentication.

Add a loading spinner while checking user authentication state. Include: – Show spinner or placeholder UI – Replace with content after auth loads – Avoid flash of unprotected content

Protect Auth Routes

Prevent unauthenticated users from accessing certain routes.

Protect the dashboard and profile routes from unauthorized users. Include: – Redirect to login if user not authenticated – Use middleware or wrapper component – Show loading state during auth check

Add Logout Functionality

Add a logout button that clears user session and redirects to login.

Add a logout button to the user dropdown menu. Include: – Clear session or token – Redirect to login page after logout – Optional confirmation modal

Show Authenticated User Info

Display current user data like name or email in the UI after login.

Show current authenticated user’s name and email in the header bar. Include: – Pull from auth context or provider – Handle missing/null values – Make layout responsive

Add Google OAuth Sign-in

Allow users to sign in using Google OAuth with a clear flow.

Add Google OAuth sign-in to the login screen. Include: – Use OAuth button with Google branding – Handle token on success – Show loading and error states

Add Password Reset Flow

Create a password reset flow with email-based recovery.

Create a password reset feature for users who forgot their password. Include: – Email input for requesting reset – Success message if email sent – Handle token and set new password

Bolt - Authentication Workflow - AI Prompts & Code Snippets | Snippets AI