s365b.graph.auth¶
App-only authentication to Microsoft Graph with a certificate.
Each app registration (Backup, Restore, Notifications) has its own certificate whose private key never leaves the server. Tokens are cached by MSAL and refreshed shortly before they expire.
Attributes¶
Exceptions¶
Raised when a token cannot be obtained. |
Classes¶
Anything that can supply a bearer token for Graph. |
|
Client-credentials flow using a certificate (no client secret). |
|
A fixed token, for tests and one-off scripts. |
Module Contents¶
- exception s365b.graph.auth.AuthError[source]¶
Bases:
ExceptionRaised when a token cannot be obtained.
- class s365b.graph.auth.TokenProvider[source]¶
Bases:
ProtocolAnything that can supply a bearer token for Graph.
- class s365b.graph.auth.CertificateCredential(tenant_id: str, client_id: str, private_key_pem: str, certificate_pem: str, authority_host: str = 'https://login.microsoftonline.com')[source]¶
Client-credentials flow using a certificate (no client secret).
- Parameters:
tenant_id – Entra tenant ID.
client_id – Application (client) ID of the app registration.
private_key_pem – PEM private key matching the uploaded certificate.
certificate_pem – PEM certificate uploaded to the app registration.
authority_host – Login host; change only for sovereign clouds.