fix: generate Google Drive connection code for embedded environments#9884
Merged
Conversation
Use out-of-band OAuth settings when marimo runs in an iframe (e.g. molab), and drop the explicit browser token for the default local flow. Co-authored-by: Cursor <cursoragent@cursor.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Bundle ReportChanges will increase total bundle size by 10.38kB (0.04%) ⬆️. This is within the configured threshold ✅ Detailed changes
Affected Assets, Files, and Routes:view changes for bundle: marimo-esmAssets Changed:
Files in
|
Contributor
There was a problem hiding this comment.
No issues found across 4 files
Architecture diagram
sequenceDiagram
participant UI as AddStorageForm
participant Hook as useIframeCapabilities
participant Gen as generateStorageCode
participant GDrive as GoogleDriveFileSystem
Note over UI,GDrive: Google Drive Connection Code Generation Flow
UI->>Hook: Check iframe environment
Hook-->>UI: isEmbedded boolean
UI->>Gen: generateStorageCode(connection, { library, isEmbedded })
alt Google Drive with service account credentials
Gen->>Gen: generateGDriveCode() with credentials_json
Gen-->>UI: fs = GoogleDriveFileSystem(token=..., use_listings_cache=False)
else Google Drive default auth (not embedded)
Gen->>Gen: generateGDriveCode(isEmbedded=false)
Gen-->>UI: fs = GoogleDriveFileSystem(use_listings_cache=False)
else Google Drive embedded auth (isEmbedded=true)
Gen->>Gen: generateGDriveCode(isEmbedded=true)
Gen-->>UI: fs = GoogleDriveFileSystem(use_listings_cache=False, auth_kwargs={"use_local_webserver": False})
Note over UI: Also prints "Run this cell again to clear the console"
end
UI->>UI: Display generated code to user
mscolnick
approved these changes
Jun 15, 2026
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
Use out-of-band OAuth settings when marimo runs in an iframe (e.g. molab), and drop the explicit browser token for the default local flow. Browser token is unecessary because that's the default, it will default to "cache" if that's available too.
In iframe:
Note that this new argument
auth_kwargsis only available in latest gdrive-fsspec (released a few days ago).use_local_webserver: Truedoesn't work in molab due to molab not exposing a port 8000 to receive the access token. Making that work would require us to create our own oauth client, and to store the creds securely.I've thought of a few ways we can clear the console but settled on this because it's the simplest.
mo.console.clear()like API? And call this in the code📋 Pre-Review Checklist
✅ Merge Checklist