Construct default token_endpoint for msgraph filesystem#69522
Merged
Conversation
anmolxlight
force-pushed
the
fix-69463-msgraph-token-endpoint
branch
from
July 7, 2026 10:44
b2b779a to
01f5022
Compare
When ObjectStoragePath is used with a sharepoint/msgraph protocol and a connection that has client_id, client_secret, and tenant_id but no explicit token_endpoint, MSGDriveFS fails because it receives a non-None oauth2_client_params dict from Airflow and skips its own token_endpoint construction logic, leaving AsyncOAuth2Client.fetch_token() without a target URL. Fix: if token_endpoint is not in oauth2_client_params and tenant_id is set, construct the default Microsoft identity platform v2.0 token endpoint: https://login.microsoftonline.com/{tenant_id}/oauth2/v2.0/token
anmolxlight
force-pushed
the
fix-69463-msgraph-token-endpoint
branch
from
July 7, 2026 13:21
01f5022 to
c7add20
Compare
dabla
approved these changes
Jul 15, 2026
joshuabvarghese
pushed a commit
to joshuabvarghese/airflow
that referenced
this pull request
Jul 16, 2026
apache#69522) When ObjectStoragePath is used with a sharepoint/msgraph protocol and a connection that has client_id, client_secret, and tenant_id but no explicit token_endpoint, MSGDriveFS fails because it receives a non-None oauth2_client_params dict from Airflow and skips its own token_endpoint construction logic, leaving AsyncOAuth2Client.fetch_token() without a target URL. Fix: if token_endpoint is not in oauth2_client_params and tenant_id is set, construct the default Microsoft identity platform v2.0 token endpoint: https://login.microsoftonline.com/{tenant_id}/oauth2/v2.0/token Co-authored-by: Anmol Mishra <anmol.mishra@hellositi.ai>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When
ObjectStoragePathis used withprotocol="sharepoint"(or any msgraph protocol) and a connection that hasclient_id,client_secret,tenant_idbut no explicittoken_endpoint,MSGDriveFSfails because:get_fsbuilds a non-Noneoauth2_client_paramsdict withclient_id,client_secret,tenant_idMSGDriveFS.__init__only constructstoken_endpointfromtenant_idwhenoauth2_client_paramsis NoneAsyncOAuth2Client.fetch_token()gets no token endpoint URL → failsFix
When
token_endpointis not inoauth2_client_paramsandtenant_idis set, construct the default Microsoft identity platform v2.0 token endpoint:https://login.microsoftonline.com/{tenant_id}/oauth2/v2.0/tokenThis matches the exact URL
msgraphfsbuilds internally whenoauth2_client_paramsis absent (line 1470 of msgraphfs/core.py).Test plan
test_get_fs_with_drive_idto expect the auto-constructedtoken_endpointtest_get_fs_with_storage_optionsto expect the auto-constructedtoken_endpointtest_get_fs_constructs_token_endpointexplicitly verifying the constructed URLtest_get_fs_with_extra_oauth_paramsstill passes — explicittoken_endpointin extras is honoured, not overwrittenFixes #69463