Skip to main content
GitHub Repo Cover

Corbado Python SDK

License documentation Slack

The Corbado Python SDK provides convenient access to the Corbado Backend API from applications written in the Python language.

integration-guides

⚠️ The Corbado Python SDK is commonly referred to as a private client, specifically designed for usage within closed backend applications. This particular SDK should exclusively be utilized in such environments, as it is crucial to ensure that the API secret remains strictly confidential and is never shared.

🚀 Getting started | 🛠️ Services | 📚 Advanced | 💬 Support & Feedback

🚀 Getting started

Requirements

  • Python 3.8 or later

Installation

Use the following command to install the Corbado Python SDK:

pip install passkeys

Usage

To create a Corbado Python SDK instance you need to provide your Project ID and API secret which can be found at the Developer Panel.

config: Config = Config(project_id="{project_id}", api_secret="{api_secret}")
sdk = CorbadoSDK(config=config)

See in action

🛠️ Services

The Corbado Python SDK provides the following services:

To use a specific service, such as users, invoke it as shown below:

user_service: UserService = sdk.users

📚 Advanced

Error handling

The Corbado Python SDK raises exceptions for all errors. The following exceptions are thrown:

  • ValidationError for failed validations (client side)
  • ServerException for server errors (server side)
  • TokenValidationException for errors in session service (client side)
  • StandardException for everything else (client side)

SessionService returns a UserEntity as a result of token validation. If the token is invalid for any reason, a TokenValidationException is thrown. It provides detailed information on the error. If no error, is thrown, the session_token is valid and you can use the UserEntity object.

try:
  user: UserEntity = sdk.sessions.validate_token(session_token)
except TokenValidationException:
  # handle error..
  pass

If the Backend API returns a HTTP status code other than 200, the Corbado Python SDK throws a ServerException. The ServerExceptionclass provides convenient methods to access all important data: sdk.users.get(user_id="usr-123456789")

        try:
            # Try to get non-existing user with ID 'usr-123456789'
            sdk.users.get(user_id="usr-123456789")
        except ServerException as e:
            # Show HTTP status code (404 in this case)
            print(f"Status Code: {e.http_status_code}")

            # Show request ID (can be used in developer panel to look up the full request
            # and response, see https://app.corbado.com/app/logs/requests)
            print(f"Request id: {e.request_id}")

            # Show full request data
            print(f"Request data: {e.request_data}")

            # Show runtime of request in seconds (server side)
            print(f"Runtime: {e.runtime}")

            # Show error type (not_found)
            print(f"Error type: {e.error_type}")

            # Show full error data
            print(f"Full error: {e.error}")

Developer Setup

Create a virtual environment and install packages -

python3 -m venv venv_name
source venv_name/bin/activate
pip install -r requirements-dev.txt

(Add venv_name to "exclude" list in .flake8, otherwise flake8 will lint the generated venv)

Add environment variables for tests (use the test project from secrets repositoty) -

export CORBADO_API_SECRET=corbado1_123456
export CORBADO_PROJECT_ID=pro-123456
export CORBADO_BACKEND_API="https://backendapi.cloud.corbado.io"

Testing

Run all tests using -

tox run -e py38

The tox tests are configured to run on Python 3.8, 3.9, 3.10, 3.11, 3.12 (you need to remove "-e py38" tox argument)

Run linting and mypy:

mypy -p corbado_python_sdk --exclude generated --strict --disable-error-code attr-defined
flake8 .

Development notes

Use Version file as single source of truth for version control.

Use VSCode with provided project/extentions configuration .vscode/settings.json

Use the recommended extentions from .vscode/extentions.json and explore their functionality to achieve expected code quality by integration tests:

💬 Support & Feedback

Report an issue

If you encounter any bugs or have suggestions, please open an issue.

Slack channel

Join our Slack channel to discuss questions or ideas with the Corbado team and other developers.

Slack

Email

You can also reach out to us via email at vincent.delitz@corbado.com.

Vulnerability reporting

Please report suspected security vulnerabilities in private to security@corbado.com. Please do NOT create publicly viewable issues for suspected security vulnerabilities.

Release files for passkeys 2.0.3

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

Source distribution (sdist)

Source distribution for passkeys 2.0.3
File Size Uploaded
passkeys-2.0.3.tar.gz 89.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for passkeys 2.0.3
File Interpreter ABI Platform
passkeys-2.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 310.3 kB

Release files / passkeys-2.0.3.tar.gz

Download URL passkeys-2.0.3.tar.gz
Size 89.2 kB
Tags Source
SHA-256 checksum
How to use checksums
d54b138124c62b01eb7e37e900c7d8b7f69c475572183c3cfab057f729ed317a
BLAKE2b-256 checksum
How to use checksums
a8e5fdf8956aa91c27657ed36ea93d0f1314f7ef9cf46fbfab4a4f6263e205b9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 17, 2025.

Transparency log

Release files / passkeys-2.0.3-py3-none-any.whl

Download URL passkeys-2.0.3-py3-none-any.whl
Size 221.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bf85fed79a4d42fb7b542921a4bf8f8a90b116dd9035c1d3defc7cd2566096fe
BLAKE2b-256 checksum
How to use checksums
b4ca8a90eb491a1af6bfd6b0950885641f8615436de2dfbec6b268e40d1fe042
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 17, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

2.0.3 This release

2 release files

2.0.2

2 release files

2.0.0

2 release files

1.1.3

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.0.1

1 release file

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