UserIdentity Class

Definition

Contains the ID, tickets, and other information associated with a user.

Note

If you are developing for Windows 10 or greater, use the Windows.Security.Authentication.Web.Core APIs instead. For more information, see Web account manager.

public ref class UserIdentity sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class UserIdentity final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class UserIdentity
Public NotInheritable Class UserIdentity
Inheritance
Object Platform::Object IInspectable UserIdentity
Attributes

Windows requirements

Device family
Windows 10 (introduced in 10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v1.0)

Examples

List<OnlineIdServiceTicketRequest> targetArray = new List<OnlineIdServiceTicketRequest>();
targetArray.Add(new OnlineIdServiceTicketRequest("wl.basic wl.contacts_photos wl.calendars",
        "DELEGATION"));

DebugPrint("Signing in ...");

Windows.Security.Authentication.OnlineId.UserIdentity result = 
        await _authenticator.AuthenticateUserAsync(targetArray, CredentialPromptType.PromptIfNeeded);

if (result.Tickets[0].Value != string.Empty)
{
    DebugPrint("Signed in.");
    IsNotSignedIn = false;
}
else
{
    // Handle errors like bad parameter, misconfigured target, and so on.
    DebugPrint("Unable to get the ticket. Error: " + result.Tickets[0].ErrorCode.ToString());
    IsNotSignedIn = true;
}

Properties

FirstName

Contains the first name of the user. This value is available only to Microsoft application partners.

Note

If you are developing for Windows 10 or greater, use the Windows.Security.Authentication.Web.Core APIs instead. For more information, see Web account manager.

Id

Gets the user's unique Microsoft account identifier. This value is available only to Microsoft application partners.

Note

If you are developing for Windows 10 or greater, use the Windows.Security.Authentication.Web.Core APIs instead. For more information, see Web account manager.

IsBetaAccount

Indicates if the user is part of a beta program. This value is available only to Microsoft application partners.

Note

If you are developing for Windows 10 or greater, use the Windows.Security.Authentication.Web.Core APIs instead. For more information, see Web account manager.

IsConfirmedPC

Indicates if the user is on a PC that they have confirmed as their PC. This value is available only to Microsoft application partners.

Note

If you are developing for Windows 10 or greater, use the Windows.Security.Authentication.Web.Core APIs instead. For more information, see Web account manager.

LastName

Contains the user's last name. This value is available only to Microsoft application partners.

Note

If you are developing for Windows 10 or greater, use the Windows.Security.Authentication.Web.Core APIs instead. For more information, see Web account manager.

SafeCustomerId

Gets an obfuscated customer ID specific to the calling application. This ID allows your application to identify the user across sessions but cannot be used to share data between separate applications since each application will receive a distinct SafeCustomerId value for the same Microsoft account.

Note

If you are developing for Windows 10 or greater, use the Windows.Security.Authentication.Web.Core APIs instead. For more information, see Web account manager.

SignInName

The sign in name of the user. This value is available only to Microsoft application partners.

Note

If you are developing for Windows 10 or greater, use the Windows.Security.Authentication.Web.Core APIs instead. For more information, see Web account manager.

Tickets

Contains an array of tickets that identify the user. If your app uses the JWT policy, only one ticket is returned. This value is only available to Microsoft application partners.

Note

If you are developing for Windows 10 or greater, use the Windows.Security.Authentication.Web.Core APIs instead. For more information, see Web account manager.

Applies to