Max length of "sub" in ID token

Kam Shing Cheung 0 Reputation points
2023-05-30T02:03:40.8633333+00:00

I found that I can user the field "sub" in the ID token as the user identifier from this document: https://learn.microsoft.com/en-us/azure/active-directory/develop/id-tokens

However, I cannot find the max length of the "sub" field .

Could you tell me what is the maximum length of the "sub" field in a token ID, or if there is a recommended string length for storing this value?

Thanks a lot.

Microsoft Entra External ID
Microsoft Entra External ID
A modern identity solution for securing access to customer, citizen and partner-facing apps and services. It is the converged platform of Azure AD External Identities B2B and B2C. Replaces Azure Active Directory External Identities.
2,639 questions
{count} votes

1 answer

Sort by: Most helpful
  1. James Hamil 21,696 Reputation points Microsoft Employee
    2023-05-31T21:45:48.43+00:00

    Hi @Kam Shing Cheung , the max length is 255.

    MicrosoftTeams-image (24)

    Please let me know if you have any questions and I can help you further.

    If this answer helps you please mark "Accept Answer" so other users can reference it.

    Thank you,

    James

    0 comments No comments