Skip to content

Cached response for get_current_user() returns incorrect data in the case of multiple users #654

@metazool

Description

@metazool

The problem

In a multi-user application, requests to get_current_user are hitting the cache of API requests and returning the user details of the first user to subsequent ones!

It's happening inside requests_cache:

https://github.com/search?q=repo%3Arequests-cache%2Frequests-cache+ignored_parameters&type=commits

Expected behavior

Requests to inat.get_current_user passing JWT token to return the details for the user who the token was issued to

Steps to reproduce the behavior

Log in as user A and obtain a JWT to use the API
Log in as user B, obtain a second JWT, get_current_user hits the cache rather than make a new request

Workarounds

Sending direct requests to api.inaturalist.org/v1/users/me with Authorization headers, bypassing the cache

Environment

  • OS & version: [e.g. Debian 10]
  • Python version: [e.g. 3.12]
  • Pyinaturalist version or branch: [e.g. 0.19 or main branch]

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions