Skip to main content

Kerliix OAuth 2.0 SDK for Python

Project description

Kerliix OAuth Python SDK

Official Kerliix OAuth 2.0 SDK for Python

PyPI version License: MIT


Overview

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

Installation

pip install kerliix-oauth

Quick Start

from 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)

Configuration Options

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

OAuth Flow

  1. User clicks login → Redirect to Kerliix via get_auth_url()
  2. Kerliix authenticates → Redirects back with ?code=XYZ
  3. Your app exchanges codeexchange_code_for_token(code)
  4. Use token → Access user data via get_user_info()
  5. Optional → Automatically refresh expired tokens using refresh_token_if_needed()

API Reference

KerliixOAuth Class

client = KerliixOAuth(client_id, client_secret, redirect_uri, base_url)

get_auth_url(scopes=None, state="")

Generates an OAuth authorization URL.

exchange_code_for_token(code)

Exchanges an authorization code for access and refresh tokens.

refresh_token_if_needed()

Refreshes the access token if it is expired or near expiry.

get_user_info(access_token=None)

Fetches user profile data. Uses cached token if access_token is not provided.

revoke_token(token)

Revokes an access or refresh token and clears cache.


Token Caching

  • Tokens are cached in memory with automatic refresh 30 seconds before expiry.
  • Works seamlessly for long-running Python applications.

License

MIT © Kerliix Corporation

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kerliix_oauth-1.0.0.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kerliix_oauth-1.0.0-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file kerliix_oauth-1.0.0.tar.gz.

File metadata

  • Download URL: kerliix_oauth-1.0.0.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.11

File hashes

Hashes for kerliix_oauth-1.0.0.tar.gz
Algorithm Hash digest
SHA256 2f177009a3dc3b40df6e33fa0dc6498ffd9cc7d71f2faceca4982c51b29e4ea2
MD5 7ededb2fa0cf7836d2d066a75aa32c15
BLAKE2b-256 1f470f41174267764161bd2bd8d4834c51e4173065e3e645bd2fd988f0b02dbf

See more details on using hashes here.

File details

Details for the file kerliix_oauth-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: kerliix_oauth-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 5.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.11

File hashes

Hashes for kerliix_oauth-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a91b8b15ce928341169eae9dd23840876cd99b3787436be0c28d938df63594f3
MD5 fec6a2fce9ebcb54060af5f1d4e7b60c
BLAKE2b-256 b8e8a30180ad5327004149c9396e4145b3141607a532aabdea5e22104d785a12

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page