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
- Sign up for a Scalekit account.
- Get your
env_url
,client_id
andclient_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"
)
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
- Quickstart Guide to implement Single Sign-on in your application: SSO Quickstart Guide
- Understand Single Sign-on basics: SSO Basics
License
This project is licensed under the MIT license. See the LICENSE file for more information.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for scalekit_sdk_python-1.0.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 62c6d5b2135b8da846e3b8d24fe7da3b0f33ea8135598f12b84e89080f31b8b5 |
|
MD5 | 79dd5a03ccb9e30cf7aee3d5dff98ded |
|
BLAKE2b-256 | e8a700e64829f66c9d0ecbe8357193e7f30ccb7c7b13efccd212ada3035bca06 |
Hashes for scalekit_sdk_python-1.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a1e50e988449d8911fb79b0b6dae6a0bc2bac6dd9d9c6472bd7cd1485119702e |
|
MD5 | 6cc1c548bd17d8e735fbc92e97e30d18 |
|
BLAKE2b-256 | 2e2d50118fcbbf900538b97783987527536d5f8154c94275da4071effbd907a2 |