token_manager¶
token_manager ¶
TokenManager ¶
Caches and transparently refreshes a Graph API app-only access token for a single Azure AD app registration.
Source code in source/src/imarina_load_researchers/core/token_manager.py
__init__ ¶
__init__(tenant_id: str, client_id: str, client_secret: str, scope: str = 'https://graph.microsoft.com/.default') -> None
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tenant_id | str | Azure AD tenant ID. | required |
client_id | str | App registration's client ID. | required |
client_secret | str | App registration's client secret. | required |
scope | str | OAuth2 scope to request the token for. | 'https://graph.microsoft.com/.default' |
Source code in source/src/imarina_load_researchers/core/token_manager.py
get_token ¶
Returns a valid access token, refreshing it first if needed.
Returns:
| Name | Type | Description |
|---|---|---|
str | str | A valid bearer access token. |
Raises:
| Type | Description |
|---|---|
TokenNotSetError | If a refresh completed without setting a token. |
Source code in source/src/imarina_load_researchers/core/token_manager.py
get_token_manager cached ¶
Returns the process-wide TokenManager singleton, creating it on first call.
Returns:
| Name | Type | Description |
|---|---|---|
TokenManager | TokenManager | The cached |