Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
0e81beb
fix(flask,fastapi): fix session initialization and simplify examples
Feb 3, 2026
ea537c3
fix(flask,fastapi): fix .env loading and remove nest_asyncio dependency
Feb 9, 2026
38cb833
Fix security vulnerabilities and improve FastAPI/Flask examples
Feb 9, 2026
e37cf8f
fix: error handling added to protected fastapi example route
Feb 10, 2026
567eb43
test: add comprehensive test coverage for Flask framework
Feb 10, 2026
27d1820
xMerge branch 'fix/fastapi-flask-sdk-example' of github.com:kinde-oss…
Feb 10, 2026
7dcaa3f
test: improved flask framework tests
Feb 11, 2026
fed08ee
test: fix resource leaks in Flask framework test tearDown
Feb 11, 2026
1940023
Merge branch 'main' into fix/fastapi-flask-sdk-example
KomanRudden Feb 11, 2026
5cc48b2
fix: remove duplicate login() call in Flask framework
Feb 12, 2026
2e3aec9
refactor: improve async handling and cleanup in Flask framework
Feb 12, 2026
d30cb9c
refactor: improve async handling in Flask framework and update tests
Feb 12, 2026
17d9291
refactor: improve async event loop handling and cleanup in Flask fram…
Feb 12, 2026
eafc8e1
fix: added flask-session to pyproject.toml, fixed test asserts
Feb 12, 2026
3eb1cc9
fix: syntax correction in tests
Feb 12, 2026
b71ff94
Refactor test_flask_framework.py: reduce duplication and improve code…
Feb 12, 2026
ae150d8
Removed unused variable in except clause
Feb 12, 2026
b4779d0
fix: use user: prefix for OAuth state storage keys
Feb 13, 2026
960fa75
fix: oauth test for null framework fixed
Feb 13, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 26 additions & 14 deletions kinde_fastapi/examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,27 @@ This is an example FastAPI application that demonstrates how to use the Kinde Fa

1. Install the required dependencies:
```bash
pip install fastapi uvicorn jinja2 python-multipart
pip install fastapi uvicorn python-multipart python-dotenv
```

2. Configure your Kinde application:
- Create a new application in your Kinde dashboard
- Set the redirect URI to `http://localhost:8000/callback`
- Copy your client ID and client secret

3. Update the configuration in `example_app.py`:
- Replace `your_client_id` with your actual client ID
- Replace `your_client_secret` with your actual client secret
- Update the URLs to match your Kinde domain
- Change the session secret key to a secure value
3. Create a `.env` file in the examples directory with the following variables:
```env
KINDE_CLIENT_ID=your_client_id
KINDE_CLIENT_SECRET=your_client_secret
KINDE_REDIRECT_URI=http://localhost:8000/callback
KINDE_HOST=https://your-domain.kinde.com
```

## Running the Example

Run the example application:
Run the example application from the SDK root directory:
```bash
python example_app.py
python -m uvicorn kinde_fastapi.examples.example_app:app --reload --port 8000
```

The application will be available at `http://localhost:8000`.
Expand All @@ -37,20 +39,30 @@ The application will be available at `http://localhost:8000`.
- Session management
- Logout

2. **Protected Routes**
2. **Automatic Route Registration**
- The OAuth class automatically registers these routes:
- `/login` - Redirects to Kinde login
- `/callback` - Handles OAuth callback from Kinde
- `/logout` - Logs out the user
- `/register` - Redirects to Kinde registration
- `/user` - Returns user information (JSON)

3. **Protected Routes**
- Example of a protected route that requires authentication
- Automatic redirection to login for unauthenticated users

3. **User Information**
4. **User Information**
- Retrieving and displaying user information
- Session-based user state management

## API Endpoints

- `/` - Home page (shows different content based on authentication status)
- `/login` - Redirects to Kinde login
- `/callback` - Handles OAuth callback from Kinde
- `/logout` - Logs out the user
- `/login` - Redirects to Kinde login (auto-registered)
- `/callback` - Handles OAuth callback from Kinde (auto-registered)
- `/logout` - Logs out the user (auto-registered)
- `/register` - Redirects to Kinde registration (auto-registered)
- `/user` - Returns user information as JSON (auto-registered)
- `/protected` - Example protected route

## Security Considerations
Expand All @@ -69,4 +81,4 @@ The application will be available at `http://localhost:8000`.
3. Add more security features
4. Use proper templates instead of inline HTML
5. Add user profile management
6. Implement role-based access control
6. Implement role-based access control
Loading