This release is a pre-release and may not be stable for production use.
supabase_auth
Python client for Supabase Auth. Most users
use it through the
supabase
package, as client.auth.
Installation
The package needs an HTTP client adapter, for example httpx:
pip install supabase_auth "supabase_utils[httpx]"
uv add supabase_auth "supabase_utils[httpx]"
Use supabase_utils[aiohttp] instead to run the async client on aiohttp.
Differences to the JavaScript client
The API follows
@supabase/auth-js,
without the browser specific code. Names are snake_case, dates are datetime
objects, and errors are raised as subclasses of AuthError instead of being
returned next to the data.
Supabase Service Compatibility
Only the latest Supabase Auth release is guaranteed to work. Older releases are supported on a best-effort basis. If you self-host, upgrade Supabase Auth when you upgrade this SDK.
Usage
The client takes the URL of the auth service and an HTTP session. Leaving its context manager closes the session and stops the automatic token refresh.
from httpx import Client
from supabase_auth import (
SignInWithPassword,
SignInWithPasswordless,
SignUpWithPassword,
SyncSupabaseAuthClient,
UserAttributes,
)
from supabase_utils.http.adapters.httpx import HttpxSession
with SyncSupabaseAuthClient(
"https://<project_ref>.supabase.co/auth/v1",
HttpxSession(Client()),
headers={"apikey": "your-publishable-key"},
) as client:
client.sign_up(
SignUpWithPassword.email("someone@example.com", "a-strong-password")
)
client.sign_in_with_password(
SignInWithPassword.email("someone@example.com", "a-strong-password")
)
# Magic link and phone one-time password
client.sign_in_with_otp(SignInWithPasswordless.email("someone@example.com"))
client.sign_in_with_otp(SignInWithPasswordless.phone("+1234567890"))
# OAuth: send the user to the returned URL
print(client.sign_in_with_oauth("google").url)
user = client.get_user()
client.update_user(UserAttributes(data={"name": "John Doe"}))
client.sign_out()
AsyncSupabaseAuthClient has the same methods. Create it with an
AsyncHttpxSession, use async with, and await each call:
from httpx import AsyncClient
from supabase_auth import AsyncSupabaseAuthClient
from supabase_utils.http.adapters.httpx import AsyncHttpxSession
async with AsyncSupabaseAuthClient(
"https://<project_ref>.supabase.co/auth/v1",
AsyncHttpxSession(AsyncClient()),
headers={"apikey": "your-publishable-key"},
) as async_client:
user = await async_client.get_user()
Multi-factor authentication
from supabase_auth import MFAEnroll
factors = client.mfa.list_factors()
factor = client.mfa.enroll(MFAEnroll.totp(friendly_name="My phone"))
challenge = client.mfa.challenge(factor.id)
client.mfa.verify(factor.id, "123456", challenge.id)
# Or both in one call
client.mfa.challenge_and_verify(factor.id, "123456")
client.mfa.unenroll(factor.id)
OAuth 2.1 server consent
When your project acts as an OAuth 2.1 server, your consent page receives an
authorization_id query parameter. Show the request and send the user to the
returned URL once they decide.
from supabase_auth import OAuthRedirect
details = client.oauth.get_authorization_details("<authorization_id>")
if isinstance(details, OAuthRedirect):
redirect_url = details.redirect_url # The user already consented
else:
print(f"{details.client.name} requests {details.scope}")
redirect_url = client.oauth.approve_authorization(
details.authorization_id
).redirect_url
for grant in client.oauth.list_grants():
client.oauth.revoke_grant(grant.client.id)
Metadata
Release files for supabase_auth 3.0.0a2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| supabase_auth-3.0.0a2.tar.gz | 47.5 kB | Without provenance | Details for supabase_auth-3.0.0a2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| supabase_auth-3.0.0a2-py3-none-any.whl | Python 3 | none | any | Details for supabase_auth-3.0.0a2-py3-none-any.whl |
Total release size: 100.8 kB
Release files / supabase_auth-3.0.0a2.tar.gz
| Download URL | supabase_auth-3.0.0a2.tar.gz |
|---|---|
| Size | 47.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9cfa34b7b227ac05b192c3c7889fe32e8a2734834011448c9f13ebb5ca88aed0
|
|
BLAKE2b-256 checksum How to use checksums |
7558e01fce54cb1fb01e18adb177a64c6bc8554f60a597983340c0745d8ba8b4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.12 {"installer":{"name":"uv","version":"0.13.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / supabase_auth-3.0.0a2-py3-none-any.whl
| Download URL | supabase_auth-3.0.0a2-py3-none-any.whl |
|---|---|
| Size | 53.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
030eb8c993c22179e33c09945f9fd4f3c2402ade84777c55fe4bcc002c2e9e4f
|
|
BLAKE2b-256 checksum How to use checksums |
7a11b56a7f88f5cffa1e6a9bc7c600699ccc5ed97f3c065a225a4f45815ac46f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.12 {"installer":{"name":"uv","version":"0.13.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for supabase_auth 3.0.0a2
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.