Skip to main content

Scalekit official Python SDK

Project description


Official Python SDK

Scalekit is an Enterprise Authentication Platform purpose built for B2B applications. This Python SDK helps implement Enterprise Capabilities like Single Sign-on via SAML or OIDC in your Python applications within a few hours.


Pre-requisites

  1. Sign up for a Scalekit account.
  2. Get your env_url, client_id and client_secret from the Scalekit dashboard.

Installation

Install Scalekit SDK using your preferred package manager.

pip install scalekit-sdk-python

Usage

from scalekit import ScalekitClient

sc = ScalekitClient(
  env_url, 
  client_id, 
  client_secret
)

# Use the sc object to interact with the Scalekit API
auth_url = sc.get_authorization_url(
  "https://acme-corp.com/redirect-uri",
  state="state",
  connection_id="con_123456789"
)
Minimum Requirements

To use the Scalekit Python SDK, you must have the following:

Component Version
Python 3.8+

Tip: Although Python 3.8 meets the minimum requirement, using a more recent version (such as Python 3.9 or later) is advisable.

Examples - SSO with FastAPI

Below is a simple code sample that showcases how to implement Single Sign-on using Scalekit SDK

from fastapi import FastAPI, Request, Response
from scalekit import ScalekitClient
import uvicorn

app = FastAPI()

sc = ScalekitClient(
  env_url, 
  client_id, 
  client_secret
)

redirect_uri = "http://localhost:8000/auth/callback"

@app.get("/auth/login")
async def auth_login(request: Request):
  auth_url = sc.get_authorization_url(
    redirect_uri,
    state="state",
    connection_id="con_123456789"
  )
  return Response(status_code=302, headers={"Location": auth_url})

@app.get("/auth/callback")
async def auth_callback(request: Request):
  code = request.query_params.get("code")
  token = sc.authenticate_with_code(
    code, 
    redirect_uri
  )
  response = JSONResponse(content=token)
  response.set_cookie("access_token", token["access_token"])

  return response

if __name__ == "__main__":
  uvicorn.run(app, port=8080)

Example Apps

Fully functional sample applications written using some popular web application frameworks and Scalekit SDK. Feel free to clone the repo and run them locally.

API Reference

Refer to our API reference docs for detailed information about all our API endpoints and their usage.

More Information

License

This project is licensed under the MIT license. See the LICENSE file for more information.

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

a_beta_scalekit-3.0.0.tar.gz (322.5 kB view details)

Uploaded Source

Built Distribution

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

a_beta_scalekit-3.0.0-py3-none-any.whl (356.3 kB view details)

Uploaded Python 3

File details

Details for the file a_beta_scalekit-3.0.0.tar.gz.

File metadata

  • Download URL: a_beta_scalekit-3.0.0.tar.gz
  • Upload date:
  • Size: 322.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for a_beta_scalekit-3.0.0.tar.gz
Algorithm Hash digest
SHA256 b1561eb690f63d6b9f8e231187bce097f261691671eea79fa4c717a4013d3fd2
MD5 6cdc0701d80e811939971d16a1842099
BLAKE2b-256 246e166098cd9943c2f8a21383dbe428dcc02478cd7cdc698f176e53fd77464d

See more details on using hashes here.

Provenance

The following attestation bundles were made for a_beta_scalekit-3.0.0.tar.gz:

Publisher: python-publish.yml on Avinash-Kamath/scalekit-sdk-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file a_beta_scalekit-3.0.0-py3-none-any.whl.

File metadata

  • Download URL: a_beta_scalekit-3.0.0-py3-none-any.whl
  • Upload date:
  • Size: 356.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for a_beta_scalekit-3.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4541aa10b77123bf55f80bd6cb33f76555c6bd9ae0597b926700f4a2aba5c273
MD5 ce992d7c33582a1bda3eb5f96323c1ed
BLAKE2b-256 48f9ce0b3cbec9472ea57cc3e0369f0f63d4dccf9800e5c0c9a6e481a6152f94

See more details on using hashes here.

Provenance

The following attestation bundles were made for a_beta_scalekit-3.0.0-py3-none-any.whl:

Publisher: python-publish.yml on Avinash-Kamath/scalekit-sdk-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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