GenAuth DocsDocuments
Concepts
User Guide
Development Integration
AgentAuth
Metadata
Development Integration
Multi-tenant (beta)
Console Documentation
Multi-tenant Console
Tenant Console
Saas Application Demo
Concepts
User Guide
Development Integration
AgentAuth
Metadata
Development Integration
Multi-tenant (beta)
Console Documentation
Multi-tenant Console
Tenant Console
Saas Application Demo
Old version
User Guide
  • Quick Start

  • Authentication

    • Overview
    • Username Password Authentication
    • SMS Code Authentication
    • Social Login Authentication
    • QR Code Login

    • Authentication in Mini Programs
    • Implement Single Sign-On (SSO)
    • Mobile SSO
    • Multi-factor Authentication
    • Extend Authentication Process

      • Add Custom Fields to IdToken
      • Extend Authentication Process with Pipeline
      • Monitor Authentication Events with Webhook
    • Customize Login UI
  • Access Control

  • Authorization

  • Adaptive MFA

  • User Account Management

  • User Directory Management

  • Applications

  • Become a Federation Authentication Identity Provider

  • Connect External Identity Providers (IdP)

  • WeChat Ecosystem Full Scenario Capabilities

  • Migrate Users to GenAuth

  • Security Settings

  • Branding

  • Automation

  • Audit Logs

  • Setting

  • FAQ

  1. User Guide
  2. /
  3. Authentication
  4. /
  5. Extend Authentication Process
  6. /
  7. Add Custom Fields to IdToken

¶ Add extended fields to IdToken

Update time: 2025-07-23 07:34:21
Edit

¶ What is IdToken

id_token is equivalent to the user's ID card. The developer's front-end should carry id_token when accessing the back-end interface. Developer server needs to verify the id_token passed by the front-end. You can use the key of the OIDC application or the public key of the OIDC application to verify the signature, and then you can get the user ID and basic information corresponding to this token. For example code, see: [Use application key to verify Token](/guides/basics/authenticate-first-user/how-to-validate-user-token.md#Use application key to verify-hs256-algorithm-signed-token).

In GenAuth, the token field of user information is an IdToken.

¶ Default fields of IdToken

An OIDC IdToken contains the following fields by default, refer to the OIDC specification (opens new window):

Field nameMeaning
subAbbreviation of subject, which is the user ID
namegiven name
given_namegiven name
family_namesurname
middle_namemiddle name
nicknamenickname
preferred_usernamepreferred name
profilebasic information
pictureavatar
websitewebsite link
emailemail
email_verifiedwhether the email is verified
gendergender
birthdatebirthday
zoneinfotime zone
localeregion
phone_numberPhone number
phone_number_verifiedVerified phone number
addressAddress
formattedDetailed address
street_addressStreet address
localityCity
regionProvince
postal_codePostal code
countryCountry
updated_atInformation update time

¶ Add extended fields to IdToken

You can use the Pipeline capability of GenAuth to insert a custom code snippet in the user authentication process and add a custom IdToken field to the user. For example, in the following example, we add the field KEY to the user's id_token, with the value VALUE:

async function pipe(user, context, callback) {
  user.addToken('KEY', 'VALUE')
  callback(null, user, context)
}

You can parse id_token on this website (opens new window).

Previous article: Extend Authentication Process Next article: Extend Authentication Process with Pipeline
  • What is IdToken
  • Default fields of IdToken
  • Add extended fields to IdToken

User identity management

Integrated third-party login
Customized authentication process

Enterprise internal management

Single sign-on
Multi-factor authentication
Permission management

Developer

Development Documentation
GitHub (opens new window)

Company

official@genauth.ai
16th Floor, Building B, Beichen Century Center, Chaoyang District, Beijing (Total)
Room 406, 4th Floor, Block B, No. 200, Tianfu Fifth Street, High-tech Zone, Chengdu (Branch)

© Beijing Steamory Technology Co., Ltd.