<p align="left">
<a href="https://scalekit.com" target="_blank" rel="noopener noreferrer">
<picture>
<img src="https://cdn.scalekit.cloud/v1/scalekit-logo-dark.svg" height="64">
</picture>
</a>
<br/>
</p>
# Official Python SDK
<a href="https://scalekit.com" target="_blank" rel="noopener noreferrer">Scalekit</a> 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.
<div>
📚 <a target="_blank" href="https://docs.scalekit.com">Documentation</a> - 🚀 <a target="_blank" href="https://docs.scalekit.com">Quick-start Guide</a> - 💻 <a target="_blank" href="https://docs.scalekit.com/apis">API Reference</a>
</div>
<hr />
## Pre-requisites
1. [Sign up](https://scalekit.com) 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.
```sh
pip install scalekit-sdk-python
```
## Usage
```py
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
```py
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.
- [FastAPI](https://github.com/scalekit-inc/scalekit-fastapi-example.git)
## API Reference
Refer to our [API reference docs](https://docs.scalekit.com/apis) 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](https://docs.scalekit.com)
- Understand Single Sign-on basics: [SSO Basics](https://docs.scalekit.com/best-practices/single-sign-on)
## License
This project is licensed under the **MIT license**.
See the [LICENSE](LICENSE) file for more information.
Raw data
{
"_id": null,
"home_page": "https://github.com/scalekit-inc/scalekit-sdk-python",
"name": "scalekit-sdk-python",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": null,
"author": "Team Scalekit",
"author_email": "support@scalekit.com",
"download_url": "https://files.pythonhosted.org/packages/e8/a7/00e64829f66c9d0ecbe8357193e7f30ccb7c7b13efccd212ada3035bca06/scalekit_sdk_python-1.0.3.tar.gz",
"platform": null,
"description": "<p align=\"left\">\n <a href=\"https://scalekit.com\" target=\"_blank\" rel=\"noopener noreferrer\">\n <picture>\n <img src=\"https://cdn.scalekit.cloud/v1/scalekit-logo-dark.svg\" height=\"64\">\n </picture>\n </a>\n <br/>\n</p>\n\n# Official Python SDK\n<a href=\"https://scalekit.com\" target=\"_blank\" rel=\"noopener noreferrer\">Scalekit</a> 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.\n\n<div>\n\ud83d\udcda <a target=\"_blank\" href=\"https://docs.scalekit.com\">Documentation</a> - \ud83d\ude80 <a target=\"_blank\" href=\"https://docs.scalekit.com\">Quick-start Guide</a> - \ud83d\udcbb <a target=\"_blank\" href=\"https://docs.scalekit.com/apis\">API Reference</a>\n</div>\n<hr />\n\n## Pre-requisites\n\n1. [Sign up](https://scalekit.com) for a Scalekit account.\n2. Get your ```env_url```, ```client_id``` and ```client_secret``` from the Scalekit dashboard.\n\n## Installation\n\nInstall Scalekit SDK using your preferred package manager. \n\n```sh\npip install scalekit-sdk-python\n\n```\n\n## Usage\n\n```py\n\nfrom scalekit import ScalekitClient\n\nsc = ScalekitClient(\n env_url, \n client_id, \n client_secret\n)\n\n# Use the sc object to interact with the Scalekit API\nauth_url = sc.get_authorization_url(\n \"https://acme-corp.com/redirect-uri\",\n state=\"state\",\n connection_id=\"con_123456789\"\n)\n\n```\n\n## Examples - SSO with FastAPI\n\nBelow is a simple code sample that showcases how to implement Single Sign-on using Scalekit SDK\n\n```py\nfrom fastapi import FastAPI, Request, Response\nfrom scalekit import ScalekitClient\nimport uvicorn\n\napp = FastAPI()\n\nsc = ScalekitClient(\n env_url, \n client_id, \n client_secret\n)\n\nredirect_uri = \"http://localhost:8000/auth/callback\"\n\n@app.get(\"/auth/login\")\nasync def auth_login(request: Request):\n auth_url = sc.get_authorization_url(\n redirect_uri,\n state=\"state\",\n connection_id=\"con_123456789\"\n )\n return Response(status_code=302, headers={\"Location\": auth_url})\n\n@app.get(\"/auth/callback\")\nasync def auth_callback(request: Request):\n code = request.query_params.get(\"code\")\n token = sc.authenticate_with_code(\n code, \n redirect_uri\n )\n response = JSONResponse(content=token)\n response.set_cookie(\"access_token\", token[\"access_token\"])\n\n return response\n\nif __name__ == \"__main__\":\n uvicorn.run(app, port=8080)\n\n```\n\n## Example Apps\n\nFully functional sample applications written using some popular web application frameworks and Scalekit SDK. Feel free to clone the repo and run them locally.\n\n- [FastAPI](https://github.com/scalekit-inc/scalekit-fastapi-example.git)\n\n## API Reference\n\nRefer to our [API reference docs](https://docs.scalekit.com/apis) for detailed information about all our API endpoints and their usage.\n\n## More Information\n\n- Quickstart Guide to implement Single Sign-on in your application: [SSO Quickstart Guide](https://docs.scalekit.com)\n- Understand Single Sign-on basics: [SSO Basics](https://docs.scalekit.com/best-practices/single-sign-on)\n\n## License\n\nThis project is licensed under the **MIT license**.\nSee the [LICENSE](LICENSE) file for more information.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Scalekit official Python SDK",
"version": "1.0.3",
"project_urls": {
"Homepage": "https://github.com/scalekit-inc/scalekit-sdk-python"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "2e2d50118fcbbf900538b97783987527536d5f8154c94275da4071effbd907a2",
"md5": "6cc1c548bd17d8e735fbc92e97e30d18",
"sha256": "a1e50e988449d8911fb79b0b6dae6a0bc2bac6dd9d9c6472bd7cd1485119702e"
},
"downloads": -1,
"filename": "scalekit_sdk_python-1.0.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "6cc1c548bd17d8e735fbc92e97e30d18",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 111445,
"upload_time": "2024-08-27T05:00:09",
"upload_time_iso_8601": "2024-08-27T05:00:09.645239Z",
"url": "https://files.pythonhosted.org/packages/2e/2d/50118fcbbf900538b97783987527536d5f8154c94275da4071effbd907a2/scalekit_sdk_python-1.0.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "e8a700e64829f66c9d0ecbe8357193e7f30ccb7c7b13efccd212ada3035bca06",
"md5": "79dd5a03ccb9e30cf7aee3d5dff98ded",
"sha256": "62c6d5b2135b8da846e3b8d24fe7da3b0f33ea8135598f12b84e89080f31b8b5"
},
"downloads": -1,
"filename": "scalekit_sdk_python-1.0.3.tar.gz",
"has_sig": false,
"md5_digest": "79dd5a03ccb9e30cf7aee3d5dff98ded",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 91626,
"upload_time": "2024-08-27T05:00:11",
"upload_time_iso_8601": "2024-08-27T05:00:11.180821Z",
"url": "https://files.pythonhosted.org/packages/e8/a7/00e64829f66c9d0ecbe8357193e7f30ccb7c7b13efccd212ada3035bca06/scalekit_sdk_python-1.0.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-27 05:00:11",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "scalekit-inc",
"github_project": "scalekit-sdk-python",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "scalekit-sdk-python"
}