Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The process of incorporating user name and phone number into an access token in the oauth2.1 authorization server of Spring Boot typically involves the following steps:

  1. Configure the user name and phone number as additional claims in the JWT access token that is issued by the authorization server. This can be achieved by adding custom fields to the token and including the relevant user information in the fields.

  2. Define a custom token enhancer that can extract the user name and phone number from the authentication context and add them to the JWT token as claims. This can be done using the Spring Security framework.

  3. Configure the authorization server to use the custom token enhancer in the token generation process. This can be achieved by specifying the enhancer in the token services configuration.

  4. Implement the necessary code in the client application to extract and use the user name and phone number from the access token. This may involve decoding and verifying the token, and extracting the relevant claim values.

Overall, the process involves customizing the token generation process to include additional user information, and ensuring that client applications are able to extract and use this information when needed.