Skip to content

check auth token when getting user#273

Merged
cdrini merged 1 commit into
internetarchive:masterfrom
RayBB:patch-1
Feb 25, 2026
Merged

check auth token when getting user#273
cdrini merged 1 commit into
internetarchive:masterfrom
RayBB:patch-1

Conversation

@RayBB

@RayBB RayBB commented Feb 4, 2026

Copy link
Copy Markdown
Collaborator

Blocking: internetarchive/openlibrary#11815

Before this pull request, when fetching a user we first checked whether a cookie was set. The purpose of that check wasn’t to use the cookie itself, but simply to avoid making a user request when no authentication information was present.

In practice, though, we never use the cookie after that check. Authentication actually relies on an auth token that’s already attached to the connection, and that token may have originally come from a cookie earlier in the flow.

This becomes a problem in the FastAPI code path: web.cookie is not set there, so the cookie check fails, even though the auth token is present and valid.

@cdrini cdrini left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We tested on testing that it login works, and following the code of _conn.get_auth_token , this does look logically equivalent. A bit nervous, but @RayBB has tested thoroughly, and easy enough to undo!

@cdrini cdrini merged commit f70607a into internetarchive:master Feb 25, 2026
2 checks passed
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.

2 participants