Skip to main content
Hanko User Data Retrieval Guide:About Hanko:Hanko is a modern open source authentication solution and the fastest way you integrate passkeys, 2FA, SSO, and more—with full control over your data. Move between self-hosted and Hanko Cloud anytime. No lock-in. Just Auth how it should be: secure, user friendly, and fully yours.What This Guide Covers: This guide demonstrates how to retrieve user data from Hanko in backend environments, including validating sessions, extracting information from JWTs, and using the Admin API.Key Technologies:
  • JWT (JSON Web Tokens)
  • Hanko Admin API
Prerequisites:
  • Active Hanko project with configured API URL
  • Basic understanding of JavaScript/TypeScript
  • Admin API access (for Admin API features - Pro/Enterprise plans only)
Tasks You’ll Complete:
  • Validate user sessions and extract JWT claims
  • Fetch comprehensive user data using the Hanko Admin API
  • Implement proper authentication checks in your application
The /sessions/validate endpoint allows you to extract user claims from the JWT token.
You can refer to the User Metadata guide for details on managing user metadata included in the JWT payload. For information on customizing session tokens with metadata, see the Session Token Customization guide.

Get user data using the Hanko Admin API

The Hanko Admin API provides comprehensive access to user status, management capabilities, metrics, and more. This example focuses on retrieving data for a specific user. To fetch data for a specific user, make a request to the /users/{id} endpoint of the Hanko Admin API, where id is the user ID obtained from the JWT.
The Hanko Admin API is available in Hanko Pro and Enterprise plans. Check out our pricing page for more information.You also need an API key secret to access the Hanko Admin API which can be generated under the Settings > API Keys section of your project.