@@ -29,19 +29,19 @@ Install [PIP](https://pip.pypa.io/en/stable/installation/) and then execute the
29
29
pip install kinde-python-sdk
30
30
```
31
31
32
- ### Environment Variables
32
+ ### Environment variables
33
33
34
34
The Kinde Python SDK v2 uses environment variables for configuration. Here are all the supported variables:
35
35
36
- #### Required Variables
36
+ #### Required variables
37
37
- ` KINDE_CLIENT_ID ` - Your application's client ID from Kinde
38
38
- ` KINDE_CLIENT_SECRET ` - Your application's client secret from Kinde
39
39
- ` KINDE_REDIRECT_URI ` - The callback URL where Kinde will redirect after authentication
40
40
- ` KINDE_HOST ` - Your Kinde domain (e.g., ` https://yourdomain.kinde.com ` )
41
41
- ` KINDE_ISSUER_URL ` - Your Kinde issuer URL (typically same as KINDE_HOST)
42
42
- ` GRANT_TYPE ` - The OAuth grant type to use (e.g., ` AUTHORIZATION_CODE_WITH_PKCE ` )
43
43
44
- #### Optional Variables
44
+ #### Optional variables
45
45
- ` KINDE_AUDIENCE ` - The intended recipient of the access token (for API access)
46
46
- ` KINDE_CALLBACK_URL ` - Alternative name for KINDE_REDIRECT_URI
47
47
- ` LOGOUT_REDIRECT_URL ` - Where users are redirected after logout
@@ -151,7 +151,7 @@ oauth = OAuth(
151
151
)
152
152
```
153
153
154
- ### Manual Route Implementation
154
+ ### Manual route implementation
155
155
156
156
If you prefer to implement the routes manually, here's how you can do it:
157
157
@@ -279,7 +279,7 @@ The Kinde Python SDK provides a simple way to check user permissions in your app
279
279
from kinde_sdk.auth import permissions
280
280
```
281
281
282
- ### Checking Permissions
282
+ ### Checking permissions
283
283
284
284
To check if a user has a specific permission:
285
285
@@ -300,7 +300,7 @@ print(f"User belongs to organization: {all_permissions['orgCode']}")
300
300
print (" User permissions:" , all_permissions[" permissions" ])
301
301
```
302
302
303
- ### Practical Examples
303
+ ### Practical examples
304
304
305
305
Here's how to use permissions in your application:
306
306
@@ -321,7 +321,7 @@ async def create_todo(todo_data: dict):
321
321
# Create todo logic here...
322
322
```
323
323
324
- ### Common Permission Patterns
324
+ ### Common permission patterns
325
325
326
326
Here are some common permission patterns you might use:
327
327
@@ -345,15 +345,15 @@ Here are some common permission patterns you might use:
345
345
346
346
For more information about setting up permissions in Kinde, see [ User permissions] ( /manage-users/roles-and-permissions/user-permissions/ ) .
347
347
348
- ## Feature Flags
348
+ ## Feature flags
349
349
350
350
The Kinde Python SDK provides a simple way to access feature flags from your application. First, import the feature flags module:
351
351
352
352
``` python
353
353
from kinde_sdk.auth import feature_flags
354
354
```
355
355
356
- ### Getting Feature Flags
356
+ ### Getting feature flags
357
357
358
358
To get a specific feature flag value:
359
359
@@ -381,7 +381,7 @@ for code, flag in all_flags.items():
381
381
print (f " - { code} : { flag.value} ( { flag.type} ) " )
382
382
```
383
383
384
- ### Practical Examples
384
+ ### Practical examples
385
385
386
386
Here's how to use feature flags in your application:
387
387
@@ -416,7 +416,7 @@ async def create_competition(competition_data: dict):
416
416
# Create competition logic here...
417
417
```
418
418
419
- ### Feature Flag Types
419
+ ### Feature flag types
420
420
421
421
The SDK supports the following feature flag types:
422
422
@@ -440,7 +440,7 @@ The SDK supports the following feature flag types:
440
440
}
441
441
```
442
442
443
- ### Common Use Cases
443
+ ### Common use cases
444
444
445
445
``` python
446
446
# Feature Toggles
@@ -465,7 +465,7 @@ The Kinde Python SDK provides a simple way to access user claims from your appli
465
465
from kinde_sdk.auth import claims
466
466
```
467
467
468
- ### Getting Claims
468
+ ### Getting claims
469
469
470
470
To get a specific claim from the user's tokens:
471
471
@@ -491,7 +491,7 @@ for claim_name, claim_value in all_claims.items():
491
491
id_token_claims = await claims.get_all_claims(token_type = " id_token" )
492
492
```
493
493
494
- ### Practical Examples
494
+ ### Practical examples
495
495
496
496
Here's how to use claims in your application:
497
497
@@ -517,7 +517,7 @@ async def protected_endpoint():
517
517
return {" message" : " Access granted" }
518
518
```
519
519
520
- ### Common Claims
520
+ ### Common claims
521
521
522
522
Here are some common claims you might want to access:
523
523
@@ -540,7 +540,7 @@ Here are some common claims you might want to access:
540
540
" org_id"
541
541
```
542
542
543
- ### Token Types
543
+ ### Token types
544
544
545
545
The SDK supports two types of tokens:
546
546
@@ -634,7 +634,7 @@ Once the user has successfully authenticated, you'll get a JWT and possibly a re
634
634
635
635
The Kinde Python SDK provides a Management API client for interacting with Kinde's management endpoints. This allows you to programmatically manage users, organizations, and other resources.
636
636
637
- ### Getting Started
637
+ ### Getting started
638
638
639
639
To use the Management API, you'll need to initialize the client with your Kinde credentials:
640
640
@@ -650,7 +650,7 @@ oauth = OAuth(
650
650
management = oauth.get_management()
651
651
```
652
652
653
- ### Available Endpoints
653
+ ### Available endpoints
654
654
655
655
The Management API provides methods for common operations on resources. Here are some examples:
656
656
@@ -678,7 +678,7 @@ updated_user = await management.update_user(
678
678
await management.delete_user(user_id = " user_123" )
679
679
```
680
680
681
- ### Organization Management
681
+ ### Organization management
682
682
683
683
``` python
684
684
# List organizations
@@ -702,7 +702,7 @@ updated_org = await management.update_organization(
702
702
await management.delete_organization(org_id = " org_123" )
703
703
```
704
704
705
- ### Error Handling
705
+ ### Error handling
706
706
707
707
The Management API methods will raise exceptions for API errors. It's recommended to handle these appropriately:
708
708
@@ -714,7 +714,7 @@ except Exception as e:
714
714
print (f " Error: { e} " )
715
715
```
716
716
717
- ### Token Management
717
+ ### Token management
718
718
719
719
The Management API client automatically handles token management, including:
720
720
- Token acquisition
@@ -724,7 +724,7 @@ The Management API client automatically handles token management, including:
724
724
725
725
You don't need to manage tokens manually - the client handles this for you.
726
726
727
- ### Best Practices
727
+ ### Best practices
728
728
729
729
1 . Always use async/await when calling Management API methods
730
730
2 . Handle API errors appropriately
0 commit comments