Skip to main content

tspscale-login

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.1

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.1
File Size Uploaded Provenance Actions
tspscale_login-1.1.1.tar.gz 3.1 kB Without provenance Details for tspscale_login-1.1.1.tar.gz

Built distribution (wheel)

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

Total release size: 6.4 kB

Release files / tspscale_login-1.1.1.tar.gz

Download URL tspscale_login-1.1.1.tar.gz
Size 3.1 kB
Tags Source
SHA-256 checksum
How to use checksums
9c0d799c36e47ec5dcd2ed820a764c006eb7a0671c7158ddb7ce6462340a3922
BLAKE2b-256 checksum
How to use checksums
d06a9adc1c4f87b03ce69995d1c3be97e5a6f44153ea0e197e1a96bfb9c88c2a
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.1-py3-none-any.whl

Download URL tspscale_login-1.1.1-py3-none-any.whl
Size 3.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ee12c2e53e573448fc32fbfbbda99fc5ee130e406fd53b8376974b0d6a667444
BLAKE2b-256 checksum
How to use checksums
bc1c74cfafd94f17df00dff70396675e1c408ce10b9e5bcde5c59d294a5bcf9e
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.1

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