This is a super simple React + Vite sample app demonstrating authentication with Descope using @descope/react-sdk
.
- Login and signup with Descope flows
- Displays authenticated user info and session token
- Logout functionality
npm install
Copy the sample environment file and set your Descope project ID and Flow ID:
cp .env.sample .env
Edit .env
and set your project and flow IDs:
VITE_DESCOPE_PROJECT_ID=your-descope-project-id-here
VITE_DESCOPE_FLOW_ID=your-descope-flow-id-here
npm run dev
Open http://localhost:5173 in your browser.
- The app uses
<AuthProvider>
from@descope/react-sdk
to provide authentication context. - The main screen shows a Descope login/signup flow if not authenticated.
- After login, the app displays the user's name/email and the session token.
- A logout button is provided to end the session.
- The authentication flow and project are determined by the
flowId
andprojectId
set in your environment variables.
- To change the authentication flow, edit the
VITE_DESCOPE_FLOW_ID
in your.env
file or theflowId
prop insrc/App.jsx
. - To use a different Descope project, edit the
VITE_DESCOPE_PROJECT_ID
in your.env
file. - For more advanced usage, see the Descope React SDK docs.