-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Doesn't work on authenticated Datasette instances #13
Comments
Options:
|
I wrote this function: async def get_with_auth(datasette, request, *args, **kwargs):
cookies = kwargs.pop("cookies") or {}
headers = kwargs.pop("headers") or {}
# Copy across cookies from request
for key, value in request.cookies.items():
if key not in cookies:
cookies[key] = value
# Also the authorization header, if set
if "authorization" in request.headers:
headers["authorization"] = request.headers["authorization"]
kwargs["cookies"] = cookies
kwargs["headers"] = headers
return await datasette.client.get(*args, **kwargs) But it's not going to work! Because of this code: datasette-enrichments/datasette_enrichments/__init__.py Lines 70 to 133 in 96cbf51
Neither of those methods have access to the Authentication is considered when a user first queues up an enrichment, but after that point the code runs independently and needs to be able to fetch new rows without adding extra authentication headers. Options for solving this:
Or... there may be one more option. I could define my own I'm going to experiment with that path first. |
That seems to work! |
Got this working on Datasette Cloud now. |
Tried this plugin on Datasette Cloud and got this error:
The problem is here:
datasette-enrichments/datasette_enrichments/views.py
Lines 38 to 42 in 96cbf51
datasette-enrichments/datasette_enrichments/views.py
Lines 87 to 91 in 96cbf51
https://github.com/datasette/datasette-enrichments/blob/96cbf510115b3ab738360f88a6e7e8070575a171/datasette_enrichments/__init__.py#L79C1-L79C1
Those calls to
datasette.client.get()
don't attempt to pass through authentication information, so a Datasette instance with extra authentication plugins installed refuses them.The text was updated successfully, but these errors were encountered: