anmolxlight opened a new pull request, #69522:
URL: https://github.com/apache/airflow/pull/69522

   ## Summary
   
   When `ObjectStoragePath` is used with `protocol="sharepoint"` (or any 
msgraph protocol) and a connection that has `client_id`, `client_secret`, 
`tenant_id` but no explicit `token_endpoint`, `MSGDriveFS` fails because:
   
   1. Airflow's `get_fs` builds a non-None `oauth2_client_params` dict with 
`client_id`, `client_secret`, `tenant_id`
   2. `MSGDriveFS.__init__` only constructs `token_endpoint` from `tenant_id` 
when `oauth2_client_params` is None
   3. `AsyncOAuth2Client.fetch_token()` gets no token endpoint URL → fails
   
   ### Fix
   
   When `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`
   
   This matches the exact URL `msgraphfs` builds internally when 
`oauth2_client_params` is absent (line 1470 of msgraphfs/core.py).
   
   ### Test plan
   
   - Updated `test_get_fs_with_drive_id` to expect the auto-constructed 
`token_endpoint`
   - Updated `test_get_fs_with_storage_options` to expect the auto-constructed 
`token_endpoint`
   - Added `test_get_fs_constructs_token_endpoint` explicitly verifying the 
constructed URL
   - Existing `test_get_fs_with_extra_oauth_params` still passes — explicit 
`token_endpoint` in extras is honoured, not overwritten
   
   Fixes #69463
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to