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 installCopy the sample environment file and set your Descope project ID and Flow ID:
cp .env.sample .envEdit .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 devOpen http://localhost:5173 in your browser.
- The app uses
<AuthProvider>from@descope/react-sdkto 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
flowIdandprojectIdset in your environment variables.
- To change the authentication flow, edit the
VITE_DESCOPE_FLOW_IDin your.envfile or theflowIdprop insrc/App.jsx. - To use a different Descope project, edit the
VITE_DESCOPE_PROJECT_IDin your.envfile. - For more advanced usage, see the Descope React SDK docs.