Auth
mail_intake.auth
Summary
Authentication provider implementations for Mail Intake.
This package defines the authentication layer used by mail adapters to obtain provider-specific credentials.
It exposes:
- A stable, provider-agnostic authentication contract.
- Concrete authentication providers for supported platforms.
Authentication providers:
- Are responsible for credential acquisition and lifecycle management.
- Are intentionally decoupled from adapter logic.
- May be extended by users to support additional providers.
Consumers should depend on the abstract interface and use concrete implementations only where explicitly required.
Public API
MailIntakeAuthProviderMailIntakeGoogleAuth
Classes
MailIntakeAuthProvider
Bases: ABC, Generic[T]
Abstract base class for authentication providers.
This interface enforces a strict contract between authentication providers and mail adapters by requiring providers to explicitly declare the type of credentials they return.
Notes
Responsibilities:
1 2 3 4 | |
Constraints:
1 2 3 4 | |
Functions
get_credentials
abstractmethod
Retrieve valid, provider-specific credentials.
Returns:
| Name | Type | Description |
|---|---|---|
T |
T
|
Credentials of type |
Raises:
| Type | Description |
|---|---|
Exception
|
An authentication-specific exception indicating that credentials could not be obtained or validated. |
Notes
Guarantees:
1 2 3 4 5 | |
MailIntakeGoogleAuth
Bases: MailIntakeAuthProvider
Google OAuth provider for Gmail access.
This provider implements the MailIntakeAuthProvider interface using
Google's OAuth 2.0 flow and credential management libraries.
Notes
Responsibilities:
1 2 3 4 | |
Guarantees:
1 2 | |
Initialize the Google authentication provider.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
credentials_path |
str
|
Path to the Google OAuth client secrets file used to initiate the OAuth 2.0 flow. |
required |
store |
CredentialStore[Credentials]
|
Credential store responsible for persisting and retrieving Google OAuth credentials. |
required |
scopes |
Sequence[str]
|
OAuth scopes required for Gmail access. |
required |
Functions
get_credentials
Retrieve valid Google OAuth credentials.
Returns:
| Name | Type | Description |
|---|---|---|
Credentials |
Any
|
A |
Raises:
| Type | Description |
|---|---|
MailIntakeAuthError
|
If credentials cannot be loaded, refreshed, or obtained via interactive authentication. |
Notes
Lifecycle:
1 2 3 4 | |