Skip to content

feat!: replace get_user_info with get_user_by_id#1

Merged
willianantunes merged 2 commits into
mainfrom
feat/change-user-details-contract
Feb 17, 2026
Merged

feat!: replace get_user_info with get_user_by_id#1
willianantunes merged 2 commits into
mainfrom
feat/change-user-details-contract

Conversation

@willianantunes
Copy link
Copy Markdown
Member

This pull request introduces a significant refactor to the Auth0 OAuth client, focusing on improved clarity and caching for user profile retrieval. The main change is the split of user info retrieval into two distinct methods: get_user_by_id (fetches and caches full user profiles from the Auth0 Management API) and get_user_info (returns the userinfo payload from the current session). This is accompanied by expanded type definitions, updated documentation, and comprehensive test coverage for the new caching logic.

API and Functionality Changes

  • Replaced the old get_user_info(user_id) method with get_user_by_id(user_id), which now fetches and caches the full user profile from the Auth0 Management API for 24 hours, with cache invalidation on user updates. [1] [2] [3]
  • Added a new get_user_info(request) method to return the userinfo payload from the current session, or None if no session exists. [1] [2]

Type Definitions and Documentation

  • Expanded the UserinfoPayload and introduced new types (UserDetailsPayload, IdentityResponseBody, IdentityProfileData, AddressPayload) to more accurately represent Auth0's user and identity data structures. [1] [2]
  • Updated the README to document the new and changed methods, clarifying the difference between session userinfo and full user profile retrieval.

Codebase and Test Updates

  • Refactored all internal and test code to use get_user_by_id for full user profile fetches, and updated mocks accordingly. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12]
  • Added and updated tests to verify caching, cache invalidation, and the new session-based userinfo retrieval. [1] [2]

Versioning

  • Bumped the package version to 0.4.0 to reflect these breaking and additive changes.

@willianantunes willianantunes self-assigned this Feb 17, 2026
@willianantunes willianantunes added the enhancement New feature or request label Feb 17, 2026
- Deprecate `get_user_info` and introduced `get_user_by_id` for fetching
user details using Auth0 Management API.
- Implement caching for user details with automatic cache invalidation
on update.
- Update test cases to use the new method and validated caching
behavior.
- Enhance session handling with a lightweight `get_user_info` for
retrieving `userinfo` from the current session.
- Updated documentation to reflect changes in API usage.

BREAKING CHANGE: `get_user_info(user_id: str)` has been replaced with
`get_user_by_id(user_id: str)`. Consumers should update their code to
use the new method.
@willianantunes willianantunes force-pushed the feat/change-user-details-contract branch 3 times, most recently from 6a48e0d to fc979b5 Compare February 17, 2026 20:17
@willianantunes willianantunes force-pushed the feat/change-user-details-contract branch from fc979b5 to 3793d94 Compare February 17, 2026 20:22
@willianantunes willianantunes merged commit 9c89f20 into main Feb 17, 2026
1 check passed
@willianantunes willianantunes deleted the feat/change-user-details-contract branch February 17, 2026 20:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant