Skip to content

add auth kwargs parameter#55

Merged
martindurant merged 6 commits into
fsspec:masterfrom
Light2Dark:sham/add-auth-kwargs
Jun 9, 2026
Merged

add auth kwargs parameter#55
martindurant merged 6 commits into
fsspec:masterfrom
Light2Dark:sham/add-auth-kwargs

Conversation

@Light2Dark

@Light2Dark Light2Dark commented Jun 6, 2026

Copy link
Copy Markdown
Collaborator

Fixes #54.

I opted for a flexible API, but I don't have strong opinions & willing to change. Also fixed running the tests without credentials.

Now I can run the following code in a remote notebook environment

fs = GoogleDriveFileSystem(token="browser", use_listings_cache=False, auth_kwargs={"use_local_webserver": False})
image

I might need to fix the test in CI.

@martindurant martindurant left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine. I would add to the auth documentation about how you can use this without a server using the device code flow, it should be helpful to others.

Comment thread gdrive_fsspec/core.py Outdated
The files need to be shared with the service account email address, that can be found
in the json file.
:param auth_kwargs: dict
Additional keyword arguments to pass to the authentication method.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May as well explicitly call out your use case of not opening a server?

@Light2Dark Light2Dark Jun 9, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks! lmk if the wording doesn't feel right. I borrowed from the original get_user_credentials docstring.

@martindurant martindurant merged commit 3c06219 into fsspec:master Jun 9, 2026
2 checks passed
@Light2Dark

Light2Dark commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator Author

Hi @martindurant , do you know when you'd cut a release for this? Thank you! We use it in production at marimo btw, very useful project.

@martindurant

Copy link
Copy Markdown
Member

Released as 0.4.1

Light2Dark added a commit to marimo-team/marimo that referenced this pull request Jun 15, 2026
…9884)

## 📝 Summary

<!--
If this PR closes any issues, list them here by number (e.g., Closes
#123).

Detail the specific changes made in this pull request. Explain the
problem addressed and how it was resolved. If applicable, provide before
and after comparisons, screenshots, or any relevant details to help
reviewers understand the changes easily.
-->
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:

<img width="1017" height="367" alt="image"
src="https://github.com/user-attachments/assets/f77fef80-5a66-40d3-8c07-4c2b21606db7"
/>

Note that this new argument `auth_kwargs` is only available in latest
[gdrive-fsspec](fsspec/gdrive-fsspec#55)
(released a few days ago).

`use_local_webserver: True` doesn'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
- Implement a custom UI/widget to display the URL, get the code etc.
- OutputRenderer to detect text like "Enter the auth code", and to clear
it

## 📋 Pre-Review Checklist
<!-- These checks need to be completed before a PR is reviewed -->

- [x] For large changes, or changes that affect the public API: this
change was discussed or approved through an issue, on
[Discord](https://marimo.io/discord?ref=pr), or the community
[discussions](https://github.com/marimo-team/marimo/discussions) (Please
provide a link if applicable).
- [x] Any AI generated code has been reviewed line-by-line by the human
PR author, who stands by it.
- [x] Video or media evidence is provided for any visual changes
(optional). <!-- PR is more likely to be merged if evidence is provided
for changes made -->

## ✅ Merge Checklist

- [x] I have read the [contributor
guidelines](https://github.com/marimo-team/marimo/blob/main/CONTRIBUTING.md).
- [ ] Documentation has been updated where applicable, including
docstrings for API changes.
- [x] Tests have been added for the changes made.


<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/marimo-team/marimo/pull/9884?utm_source=github"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img
alt="Review in cubic"
src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a>
<!-- End of auto-generated description by cubic. -->

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Running token="browser" but with use_local_webserver=False

2 participants