AuthenticationResult.UniqueId Property

Definition

Gets the Unique Id of the account in this TenantId It is set as the oid (ObjectId) claim, or if that claim is null, as the sub (Subject) claim which is guaranteed not-null.

public string UniqueId { get; }
member this.UniqueId : string
Public ReadOnly Property UniqueId As String

Property Value

Remarks

The oid claim identifies a user in all apps - Microsoft Identity Providers issue ID tokens with this claim, although it can be null in rare cases. The sub claim is "a locally unique and never reassigned identifier within the Issuer for the End-User" as per https://openid.net/specs/openid-connect-core-1_0.html and it is a mandatory claim with OIDC compliant issuers. Guest AAD accounts have different oid claim values in each tenant. Use Microsoft.Identity.Client.Account.HomeAccountId to uniquely identify users across tenants. See https://docs.microsoft.com/azure/active-directory/develop/id-tokens#payload-claims

Applies to