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 frontend environments, including accessing user profiles, validating sessions, extracting information from JWTs.Key Technologies:
- Hanko Frontend SDK
- Hanko Elements
- JWT (JSON Web Tokens)
- Active Hanko project with configured API URL
- Basic understanding of JavaScript/TypeScript
- Retrieve current user profile data using the Frontend SDK
- Validate user sessions and extract JWT claims
- Implement proper authentication checks in your application
Get user data from API
To access user data in your frontend application, use thehanko.getUser()
method from the hanko-frontend-sdk
(also available via hanko-elements).
Get user data from the session cookie
To extract user claims from the JWT token, use thehanko.validateSession()
function.