Official Kerliix OAuth 2.0 SDK for Python
Kerliix OAuth Python SDK provides a simple and secure way to integrate Kerliix authentication into your Python applications. It handles the full OAuth 2.0 flow including:
- Generating authorization URLs
- Exchanging authorization codes for tokens
- Token caching and auto-refresh
- Fetching user profile data
- Revoking tokens
pip install kerliix-oauthfrom kerliix_oauth import KerliixOAuth
client = KerliixOAuth(
client_id="YOUR_CLIENT_ID",
client_secret="YOUR_CLIENT_SECRET",
redirect_uri="http://localhost:5175/callback",
base_url="http://localhost:4000"
)
# Step 1: Generate auth URL
print("Login at:", client.get_auth_url())
# Step 2: Exchange code for tokens
# code = input("Enter code from redirect URL: ")
# tokens = client.exchange_code_for_token(code)
# print("Tokens:", tokens)
# Step 3: Fetch user info
# user = client.get_user_info(tokens.access_token)
# print("User:", user)| Option | Required | Description |
|---|---|---|
client_id |
✅ | Your app’s client ID from Kerliix developer portal |
client_secret |
⚙️ | Required for server-side (authorization code flow) |
redirect_uri |
✅ | The callback URI registered in your app |
base_url |
✅ | Your Kerliix OAuth server URL |
- User clicks login → Redirect to Kerliix via
get_auth_url() - Kerliix authenticates → Redirects back with
?code=XYZ - Your app exchanges code →
exchange_code_for_token(code) - Use token → Access user data via
get_user_info() - Optional → Automatically refresh expired tokens using
refresh_token_if_needed()
client = KerliixOAuth(client_id, client_secret, redirect_uri, base_url)Generates an OAuth authorization URL.
Exchanges an authorization code for access and refresh tokens.
Refreshes the access token if it is expired or near expiry.
Fetches user profile data. Uses cached token if access_token is not provided.
Revokes an access or refresh token and clears cache.
- Tokens are cached in memory with automatic refresh 30 seconds before expiry.
- Works seamlessly for long-running Python applications.
MIT © Kerliix Corporation