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.2.tar.gz (5.7 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.2-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: kerliix_oauth-1.0.2.tar.gz
  • Upload date:
  • Size: 5.7 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.2.tar.gz
Algorithm Hash digest
SHA256 13b94e762b1f7b70ef824584831301855a938435fd26f46377683130d5696936
MD5 d63f6d23a64b7266fa384f0cb577299a
BLAKE2b-256 f96e505f68a734a6bd140e601c38cf77d548eb43604ec6f5fbbf73567daac782

See more details on using hashes here.

File details

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

File metadata

  • Download URL: kerliix_oauth-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 6.3 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ae6dbf564a717e7a8e7a9ea3fdff11e1640192db62c1cca4af037f498dae0e7f
MD5 171c1b56a830d4a98a0995e3d7ae337e
BLAKE2b-256 1e122f9232672a9be5e3f6d8f4cc0915697277c62b959f56bf1701ee25a3e99d

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