React single-page app
A Vite and React app with sign-in through the hosted page and a callback route.
StarterPlanned
This example is planned. Not built yet. This page is the specification for the example.
What you get
- The provider around the app.
- A header that changes with the session.
- A callback route.
- A protected route.
Create it
npm create vite@latest my-app -- --template react-ts
cd my-app
npm install @lumoauth/react
Then add the files below.
Settings
| Variable | Value |
|---|---|
VITE_LUMOAUTH_DOMAIN | https://app.lumoauth.dev |
VITE_LUMOAUTH_ORG_ID | Your organization. |
VITE_LUMOAUTH_CLIENT_ID | The client ID of a public application. |
Files
| File | What it does |
|---|---|
src/main.tsx | LumoAuthProvider |
src/pages/AuthCallback.tsx | AuthCallback |
src/components/Header.tsx | SignedIn, SignedOut, UserButton, SignInButton |
Next steps
- Hide parts of the page by permission: Show and hide UI by permission.
- Protect your API: Protect routes in each framework.