-
Notifications
You must be signed in to change notification settings - Fork 41
docs(python-sdk): add comprehensive async/sync architecture documenta… #565
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
docs(python-sdk): add comprehensive async/sync architecture documenta… #565
Conversation
…tion - Add AsyncOAuth client for native async applications - Add SmartOAuth client for context-aware async/sync usage - Add standalone usage patterns for serverless/Lambda functions - Update all code examples with proper sync/async patterns - Add framework-specific implementation guides (Flask, FastAPI) - Restructure authentication flow documentation - Add migration recommendations and client selection guide - Update permissions, claims, and feature flags examples - Add Management API sync/async usage patterns - Improve error handling and best practices sections BREAKING: No breaking changes - maintains backward compatibility
## Configure your app | ||
|
||
The OAuth client is now automatically configured based on the framework you're using. Simply import the OAuth class from the auth module and create an instance: | ||
The Kinde Python SDK provides three different OAuth client types to support various application patterns: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Says three but 5 are listed. Could we replace 'three' with 'several'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There three different libraries, 4 and 5 are examples of how to implement the 3 libraries.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am with @clairekinde11 here, it's not clear the distinction here.
4 and 5 should be updated to be examples, isn't the framework optional also?
</div> | ||
``` | ||
|
||
### Automatic Route Registration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we make this a H2, so that the H4s that follow can be made into H3s. Please try to avoid H4
|
||
Here's how to use permissions in your application: | ||
|
||
#### Flask (Synchronous) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change this heading to ### Example: Flask (Synchronous), and follow for following H4s.
Remove lines 483 and 485
|
||
Here's how to use feature flags in your application: | ||
|
||
#### Flask (Synchronous) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we do same as previous section - H3 ### Example: Flask (Synchronous)
etc.
|
||
Here's how to use claims in your application: | ||
|
||
#### Flask (Synchronous) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See previous, H3 ### Example: Flask (Synchronous)
Delete 771, 773
To use the Management API, you'll need to initialize the client with your Kinde credentials: | ||
To use the Management API, you can initialize the client directly or through your OAuth client: | ||
|
||
#### Direct initialization |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make these H3s - the small H3 intros and pushing the heading levels too far
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some comments about heading levels - would like to avoid H4s they are not as searchable, easy to scan, and do not show up in the context page menu.
…cture - Promote main section headings from ### to ## - Standardize subsection headings from #### to ### - Improve document hierarchy and navigation consistency - Enhance readability and accessibility of documentation structure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay from copy and structure perspective - awaiting tech review
## Configure your app | ||
|
||
The OAuth client is now automatically configured based on the framework you're using. Simply import the OAuth class from the auth module and create an instance: | ||
The Kinde Python SDK provides three different OAuth client types to support various application patterns: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am with @clairekinde11 here, it's not clear the distinction here.
4 and 5 should be updated to be examples, isn't the framework optional also?
## Important Notes | ||
|
||
### Async/Sync Consistency | ||
The SDK now provides consistent async and sync APIs to address previous inconsistencies: | ||
- **Auth modules** (permissions, claims, feature_flags) are async and work with all client types | ||
- **OAuth methods** are now properly separated into sync and async versions | ||
- **SmartOAuth** provides a unified interface that adapts to the execution context | ||
|
||
### Backward Compatibility | ||
All existing code continues to work without changes: | ||
- The original `OAuth` class remains unchanged | ||
- Existing sync methods remain sync | ||
- Existing async methods remain async | ||
- No breaking changes to the public API | ||
|
||
### Migration Recommendations | ||
- **New Flask projects**: Use `OAuth` for simplicity | ||
- **New FastAPI projects**: Use `AsyncOAuth` for best performance | ||
- **Mixed projects**: Use `SmartOAuth` for flexibility | ||
- **Serverless/Lambda**: Use `AsyncOAuth` with `framework=None` | ||
- **Existing projects**: No changes required, but consider migrating for better consistency | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like summary of changes should it be removed?
Description (required)
Related issues & labels (optional)