[DO NOT MERGE] feat(userinfo): add getUserInfo() to auth0-auth-js and auth0-server-js - #228
[DO NOT MERGE] feat(userinfo): add getUserInfo() to auth0-auth-js and auth0-server-js#228tusharpandey13 wants to merge 1 commit into
Conversation
…s (G8) Adds OIDC /userinfo support to close the last gap (G8) in the node-auth0 authentication-separation parity set. auth0-auth-js (stateless core): - AuthClient.getUserInfo(options): live /userinfo fetch via openid-client fetchUserInfo; optional expectedSubject (defaults to skipSubjectCheck). - New UserInfoError (extends ApiError), GetUserInfoOptions, and an auth0-owned UserInfoResponse interface (only `sub` required, catch-all index signature) for a stable public contract independent of openid-client. auth0-server-js (session layer): - ServerClient.getUserInfo(storeOptions?): live fetch using the session's access token (auto-refresh via getAccessToken). Throws MissingSessionError on no session, missing user sub, or resolver-mode domain mismatch; resolves the per-domain AuthClient in resolver mode. Always passes the session `sub` as expectedSubject for an OIDC subject-consistency check. Re-exports UserInfoError. Tests: 12 auth-js + 11 server-js (MSW HTTP-layer). Docs: EXAMPLES.md in both packages. Additive, minor bump; no breaking changes. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
Warning Review limit reached
Next review available in: 19 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (9)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
/userinfosupport (gap G8 — last open item in the node-auth0 authentication-separation parity set).AuthClient.getUserInfo(options)— stateless live fetch via openid-clientfetchUserInfo; optionalexpectedSubject(defaults toskipSubjectCheck). NewUserInfoError,GetUserInfoOptions, and an auth0-ownedUserInfoResponseinterface (onlysubrequired + catch-all index signature) for a stable public contract independent of the openid-client version.ServerClient.getUserInfo(storeOptions?)— live fetch using the session access token with automatic refresh. ThrowsMissingSessionErroron no session / missing usersub/ resolver-mode domain mismatch; resolves the per-domainAuthClientin resolver mode; always passes the sessionsubasexpectedSubjectfor an OIDC subject-consistency check. Re-exportsUserInfoError.Additive, minor version bump in both packages. No breaking changes.
Design notes
getUserInfo()is a live network call — distinct from the existinggetUser(), which returns cached ID-token claims. Documented in EXAMPLES.md.subto openid-client so a token/session subject mismatch is caught automatically (stronger than node-auth0).#getAuthClient(domain)(mirrorslogout/revokeRefreshToken), becausethis.authClientis only available for a static-domain configuration.Test plan
npm run build/npm run lintpass both packagesRisk
/userinfoshows 89.1% success over 90d (lowest of the ported endpoints) — likely benign (401s from expired/invalid access tokens). Cross-check the grant-type/endpoint telemetry stitch before GA. Non-blocking for merge.🤖 Generated with Claude Code