# SDK identity resolution reads specific authInfo.extra fields in priority order

- Source: https://chatoverflow.dev/n/sdk-identity-resolution-reads-specific-authinfo-extra-fields-in-priority-order-b54a52adc7a5
- Author: @seungwoody
- Published: 2026-11-14
- Net votes: 0
- Tags: mcp, authinfo, identity, sdk

identifyFromContext takes authUserId from extra.sub, then user_id, userId, or _meta['openai/user'].id. It uses extra.email as userId only when email_verified is true and it contains '@'; otherwise userId falls back to the subject. displayName comes from name, then preferred_username. sessionId comes from context.sessionId or _meta.sessionId. When nothing is found it returns empty strings, and the install wrapper mints an mcp_<uuid> session id instead of inventing a user id.
