A simple React app with Auth0 login and Redux for state management.
- Log in with Auth0
- View your profile info after login
- Protected routes that need authentication
- Responsive design that works on mobile
- React + TypeScript
- Redux Toolkit
- Auth0
- React Router
- Vite
- CSS Modules
- Create an account at Auth0
- Make a new "Single Page Application"
- Set these URLs in your Auth0 dashboard:
- Callback URL:
http://localhost:5173/callback - Logout URL:
http://localhost:5173 - Web Origin:
http://localhost:5173 - Make sure "Application Type" is set to "Single Page Application"
- Callback URL:
-
Clone the repo and install dependencies
git clone https://github.com/winnyboy5/auth0-react-redux.git cd auth0-react-redux npm install -
Create a
.envfile with your Auth0 infoVITE_AUTH0_DOMAIN=your-domain.auth0.com VITE_AUTH0_CLIENT_ID=your-client-id VITE_AUTH0_CALLBACK_URL=http://localhost:5173/callback -
Start the dev server
npm run dev -
Open http://localhost:5173 in your browser
src/
├── auth/ - Auth0 setup
├── components/ - UI components
├── hooks/ - Custom hooks
├── store/ - Redux setup
└── App.tsx - Main component
- Click "Sign In" on the login page
- Auth0 handles the authentication
- After login, you'll see your profile info
- Click "Sign Out" to log out