Fix Microsoft Graph filesystem auth by defaulting OAuth2 scope - #70879
Fix Microsoft Graph filesystem auth by defaulting OAuth2 scope#70879haseebmalik18 wants to merge 1 commit into
Conversation
eaa30b7 to
764a9de
Compare
|
Good diagnosis — the connection form does expose a The precedence you chose is right — explicit One thing to fix before this goes in: the two consumers of that same field disagree on how it is delimited.
scopes = config.get("scopes", self.scopes)
if isinstance(scopes, str):
scopes = scopes.split(",")This change passes the value through verbatim into the OAuth2 That is the same shape as the bug being fixed here: one field, two consumers, different expectations. Something like this keeps both readings working: scopes = get_field(conn_id=conn_id, conn_type=conn_type, extras=extras, field_name="scopes")
if isinstance(scopes, str):
scopes = " ".join(s.strip() for s in scopes.split(",") if s.strip())
oauth2_client_params["scope"] = scopes or DEFAULT_SCOPEWorth a fourth parametrize case with a comma-separated value so the behaviour is pinned rather than assumed. Minor, while you're in there: Drafted-by: Claude Code (Opus 5); reviewed by @potiuk before posting |
764a9de to
431b39f
Compare
Fixes the Microsoft Graph filesystem failing to authenticate when the connection is set up through the UI.
The connection form only exposes a "Scopes" field, but get_fs() hands MSGDriveFS a fully built oauth2_client_params dict. That makes the library skip its own scope default, so authlib ends up with no scope and the connection fails. This falls back to the connection's scopes value, then to the Graph default, so a UI-configured connection works without hand-adding a scope key to extras.
closes: #70822