A Reflex application with FastAPI backend and SSO/OAuth authentication.
- Reflex frontend with responsive UI
- FastAPI backend integration
- Authentication with:
- Username/password login
- Google OAuth
- GitHub OAuth
- Protected routes
- JWT token-based authentication
- Persistent login with localStorage
- Clone the repository:
git clone https://github.com/christokur/reflex-sso-app.git
cd reflex-sso-app
- Install dependencies:
pip install -r requirements.txt
- Set up environment variables:
# For development, you can use .env file
export SECRET_KEY="your-secret-key"
export GOOGLE_CLIENT_ID="your-google-client-id"
export GOOGLE_CLIENT_SECRET="your-google-client-secret"
export GITHUB_CLIENT_ID="your-github-client-id"
export GITHUB_CLIENT_SECRET="your-github-client-secret"
- Run the app:
reflex run
- Open your browser at http://localhost:3000
- Go to the Google Cloud Console
- Create a new project
- Navigate to "APIs & Services" > "Credentials"
- Create an OAuth 2.0 Client ID
- Set the authorized redirect URI to
http://localhost:3000/auth/callback/google
- Copy the Client ID and Client Secret to your environment variables
- Go to your GitHub Settings
- Navigate to "Developer settings" > "OAuth Apps"
- Create a new OAuth App
- Set the authorization callback URL to
http://localhost:3000/auth/callback/github
- Copy the Client ID and Client Secret to your environment variables
reflex_sso_app/
├── reflex_sso_app/
│ ├── __init__.py # App initialization
│ ├── main.py # Main app module
│ ├── state.py # State management
│ ├── api/ # FastAPI backend
│ │ ├── __init__.py # API initialization
│ │ └── auth.py # Authentication endpoints
│ ├── components/ # Reusable components
│ │ ├── layout.py # Layout component
│ │ └── navbar.py # Navigation bar
│ └── pages/ # App pages
│ ├── index.py # Home page
│ ├── login.py # Login page
│ └── dashboard.py # Dashboard (protected)
└── requirements.txt # Dependencies
MIT