sda.api.graph_context#

Request-scoped Microsoft Graph bearer token override.

Used by the SDA-Cloud (hosted) dashboard: after a user signs in with the web app registration, the access token is stored in the HTTP session and injected into a contextvars.ContextVar for the duration of the request so get_token_auto() can call SharePoint as that user without changing every Graph caller.

Functions#

set_request_graph_token(token)

Set the Graph access token for the current async context; return reset handle.

reset_request_graph_token(ctx)

Restore the previous token value (call in finally).

get_request_graph_token()

Return the token for this context, or None if not set.

clear_request_graph_token()

Remove any override (sets context to None).

Module Contents#

sda.api.graph_context.set_request_graph_token(token)#

Set the Graph access token for the current async context; return reset handle.

sda.api.graph_context.reset_request_graph_token(ctx)#

Restore the previous token value (call in finally).

sda.api.graph_context.get_request_graph_token()#

Return the token for this context, or None if not set.

sda.api.graph_context.clear_request_graph_token()#

Remove any override (sets context to None).