Skip to main content

tspscale-login-python

Critical Update Added: Important PKCE Security Fix. Please upgrade to the latest version immediately to maintain login functionality with TSP Scale.

Official Python SDK for TSP Scale Authentication.

🚀 Quick Start (Zero-Config)

Easily integrate TSP Scale OAuth 2.0 into your Python backends (Django, Flask, FastAPI). This package acts as a full Confidential Client, capable of handling authorization URLs, secure token exchanges, and token verification.

Installation

pip install tspscale-login

🛠️ Usage

1. Generating the Authorization URL

Redirect your users to this URL so they can log in via TSP Scale.

from tspscale_login import TSPClient

client = TSPClient(
    client_id='YOUR_CLIENT_ID',
    client_secret='YOUR_CLIENT_SECRET',
    redirect_uri='http://localhost:8000/callback'
)

auth_url = client.get_authorization_url()
# Redirect your user to `auth_url`

2. Exchanging the Code for a Token

When the user returns to your redirect_uri, they will have a code in the URL parameters.

# Assuming you extracted the `code` from the URL query string
token_data = client.exchange_token(code)

if 'error' in token_data:
    print("Failed to login:", token_data['error'])
else:
    access_token = token_data['access_token']
    print("Successfully retrieved access token!", access_token)

3. Verifying a Token / Getting the User Profile

Once you have an access token (or if you are just verifying a token sent by a React frontend), use verify_token.

from tspscale_login import TSPAuthException

try:
    data = client.verify_token(access_token)
    user_profile = data['user']
    print(f"Logged in as: {user_profile['email']}")
except TSPAuthException as error:
    print(f"Authentication failed: {str(error)}")

Metadata

Release files for tspscale-login 1.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tspscale-login 1.1.2
File Size Uploaded Provenance Actions
tspscale_login-1.1.2.tar.gz 3.4 kB Without provenance Details for tspscale_login-1.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for tspscale-login 1.1.2
File Interpreter ABI Platform Actions
tspscale_login-1.1.2-py3-none-any.whl Python 3 none any Details for tspscale_login-1.1.2-py3-none-any.whl

Total release size: 7.0 kB

Release files / tspscale_login-1.1.2.tar.gz

Download URL tspscale_login-1.1.2.tar.gz
Size 3.4 kB
Tags Source
SHA-256 checksum
How to use checksums
481b226ad8781b3aac6f08f28150fada0140c03e3ce503845a0e6564b1c012c8
BLAKE2b-256 checksum
How to use checksums
1c5b31eb3d7157a725410673fc7ad12cab9c662236d4c97e59c1386273bb10fe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.2

Release files / tspscale_login-1.1.2-py3-none-any.whl

Download URL tspscale_login-1.1.2-py3-none-any.whl
Size 3.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
53b64b47c1a318a199adeb81e41f46257ef23788e0532d3a29acddd8d156b4e1
BLAKE2b-256 checksum
How to use checksums
ab2916e951163ecfe1c7f06974579a284ff7123b0f36360298b2c74a40ec726d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.2

Security for tspscale-login 1.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page