Skip to content

About

client for integrating Authwave into your projects.

Resources

Stars

0 stars

Watchers

2 watching

Forks

Latest commit

 

History

12 Commits

Folders and files

Repository files navigation

Authwave Python client

Connect Python applications to an Authwave provider. Supports Flask, Django, FastAPI, WSGI and ASGI with server-side sessions and encrypted authentication exchanges.

pip install 'authwave[flask]'
from authwave.integrations.flask import authwave_handler
from authwave.runtime import MemorySessionStore, SessionOptions

options = SessionOptions(MemorySessionStore(), secure_cookie=False)  # Local HTTP.

@app.route('/login')
@authwave_handler(options, client_key=client_key)
def login(auth):
    auth.set_return_uri('/')
    auth.login()

Wrap the return route too. It can read auth.is_logged_in() and auth.get_auth_user().id / .email. The full examples include login, logout and callback handling. See the wiki for setup and the API reference.

The complete provider-issued key belongs on the server. The final underscore separates the deployment identifier from the raw 32-byte secret. authwave_host defaults to login.authwave.com.

MemorySessionStore is for development. Production applications need a shared persistent SessionStore and HTTPS; cookies are Secure by default. Authentication data stays in server-side storage; never put serialized tokens in browser cookies. Authentication callbacks are synchronous and run at most once per exchange under sequential session processing.

Development

python -m venv .venv
. .venv/bin/activate
pip install -e '.[test]'
pytest
python -m build

Tests include 68 deterministic PHP-reference scenarios and complete framework login/logout flows using simulated provider responses. To also execute the PHP source and check the fixtures, set AUTHWAVE_PHP_REFERENCE to the PHP checkout with installed Composer dependencies.

PARITY.md maps the PHP API to its Python equivalents.

About

client for integrating Authwave into your projects.

Resources

Stars

0 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages