Skip to content

🚀 Add Clerk Authentication to Vite + React App#2

Merged
maverickOG merged 1 commit intomainfrom
01-Frontend-Auth
Feb 8, 2025
Merged

🚀 Add Clerk Authentication to Vite + React App#2
maverickOG merged 1 commit intomainfrom
01-Frontend-Auth

Conversation

@maverickOG
Copy link
Copy Markdown
Owner

Description:

This PR integrates Clerk authentication into the Vite + React project. Users can now sign in and out using Clerk's authentication components.

Changes Introduced:

  • Installed @clerk/clerk-react and @clerk/clerk-sdk-node.
  • Added ClerkProvider in main.tsx to wrap the app with authentication support.
  • Updated App.tsx to display authentication UI:
    • SignedIn: Shows user info and a sign-out button.
    • SignedOut: Displays a sign-in button.
  • Added .env.local support for VITE_CLERK_PUBLISHABLE_KEY.

How to Test:

  1. Create a .env.local file and add your Clerk API keys.
  2. Run the project using npm run dev.
  3. Click the Sign In button and authenticate.
  4. Verify that the user info appears when signed in.
  5. Click the Sign Out button and confirm logout works.

Notes:

  • Future improvements can include role-based authentication and protected routes.
  • Let me know if any changes are needed!

@maverickOG maverickOG merged commit 5d1d673 into main Feb 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant