OAuth router helpers¶
Public OAuth helpers are implemented in litestar_auth.oauth.router (the litestar_auth.oauth package re-exports them lazily).
litestar_auth.oauth.router
¶
Helpers for constructing provider-specific OAuth controllers.
create_provider_oauth_controller(*, provider_name, backend, user_manager, oauth_client=None, oauth_client_factory=None, oauth_client_class=None, oauth_client_kwargs=None, redirect_base_url, auth_path='/auth', path=None, cookie_secure=True, associate_by_email=False, trust_provider_email_verified=False)
¶
Build a provider-specific OAuth controller from a client or lazy factory.
Returns:
| Type | Description |
|---|---|
type[Controller]
|
Generated controller class mounted under the provider-specific path. |
Raises:
| Type | Description |
|---|---|
ConfigurationError
|
If no OAuth client configuration is provided. |
Source code in litestar_auth/oauth/router.py
load_httpx_oauth_client(oauth_client_class, /, **client_kwargs)
¶
Import and instantiate an httpx-oauth client lazily.
Returns:
| Type | Description |
|---|---|
object
|
Instantiated OAuth client. |
Raises:
| Type | Description |
|---|---|
ImportError
|
If the optional |
ModuleNotFoundError
|
If a non- |
ConfigurationError
|
If the client path is invalid or the class cannot be imported. |