A synchronous, dependency-free Python client for the authentication API. Its
supported methods match the current @crydensync/sdk JavaScript client.
pip install crydensync-sdkFor local development:
pip install -e .from crydensync import Cryden, CrydenError
client = Cryden("https://auth.example.com")
user = client.sign_up("dev@example.com", "SecurePass123!")
tokens = client.login("dev@example.com", "SecurePass123!")
print(user["user_id"], client.verify()["user_id"])
try:
sessions = client.list_sessions()
except CrydenError as error:
print(error.code, error.status, str(error))The SDK adds /v1 to the base URL. It stores tokens in memory by default.
Supply a storage adapter to customize persistence:
from crydensync import Cryden, FileStorageAdapter
client = Cryden(
"https://auth.example.com",
storage=FileStorageAdapter("~/.config/myapp/cryden-tokens.json"),
)FileStorageAdapter stores its values as plain text. Choose an encrypted
adapter when local filesystem access is not trusted. You can also implement
StorageAdapter with get(key), set(key, value), and remove(key) methods.
sign_up,login,is_authenticatedlogout,logout_all,verifylist_sessions,revoke_sessionchange_password,delete_accountrequest_email_change,confirm_email_change
Authenticated calls refresh once after a 401 and retry with the new access token. Failed refresh clears the stored token pair. Password changes and account deletion clear local tokens after success. Email change confirmation does not require authentication.
python -m pip install -e .
python smoketest.py http://localhost:8080MIT