共用方式為


PublicClientApplication Constructors

Definition

Overloads

PublicClientApplication(String)
Obsolete.

Constructor of the application. It will use https://login.microsoftonline.com/common as the default authority.

PublicClientApplication(String, String)
Obsolete.

Constructor of the application.

PublicClientApplication(String, String, TokenCache)
Obsolete.

Constructor to create application instance. This constructor is only available for Desktop and NetCore apps

PublicClientApplication(String)

Caution

Use PublicClientApplicationBuilder instead. See https://aka.ms/msal-net-3-breaking-changes.

Constructor of the application. It will use https://login.microsoftonline.com/common as the default authority.

[System.Obsolete("Use PublicClientApplicationBuilder instead. See https://aka.ms/msal-net-3-breaking-changes. ", true)]
public PublicClientApplication (string clientId);
[<System.Obsolete("Use PublicClientApplicationBuilder instead. See https://aka.ms/msal-net-3-breaking-changes. ", true)>]
new Microsoft.Identity.Client.PublicClientApplication : string -> Microsoft.Identity.Client.PublicClientApplication
Public Sub New (clientId As String)

Parameters

clientId
String

Client ID (also known as App ID) of the application as registered in the application registration portal (https://aka.ms/msal-net-register-app)/. REQUIRED

Attributes

Applies to

PublicClientApplication(String, String)

Caution

Use PublicClientApplicationBuilder instead. See https://aka.ms/msal-net-3-breaking-changes.

Constructor of the application.

[System.Obsolete("Use PublicClientApplicationBuilder instead. See https://aka.ms/msal-net-3-breaking-changes. ", true)]
public PublicClientApplication (string clientId, string authority);
[<System.Obsolete("Use PublicClientApplicationBuilder instead. See https://aka.ms/msal-net-3-breaking-changes. ", true)>]
new Microsoft.Identity.Client.PublicClientApplication : string * string -> Microsoft.Identity.Client.PublicClientApplication
Public Sub New (clientId As String, authority As String)

Parameters

clientId
String

Client ID (also named Application ID) of the application as registered in the application registration portal (https://aka.ms/msal-net-register-app)/. REQUIRED

authority
String

Authority of the security token service (STS) from which MSAL.NET will acquire the tokens. Usual authorities are:

  • https://login.microsoftonline.com/tenant/, where tenant is the tenant ID of the Azure AD tenant or a domain associated with this Azure AD tenant, in order to sign-in user of a specific organization only
  • https://login.microsoftonline.com/common/ to signing users with any work and school accounts or Microsoft personal account
  • https://login.microsoftonline.com/organizations/ to signing users with any work and school accounts
  • https://login.microsoftonline.com/consumers/ to signing users with only personal Microsoft account (live)
Note that this setting needs to be consistent with what is declared in the application registration portal

Attributes

Applies to

PublicClientApplication(String, String, TokenCache)

Caution

Use PublicClientApplicationBuilder instead. See https://aka.ms/msal-net-3-breaking-changes.

Constructor to create application instance. This constructor is only available for Desktop and NetCore apps

[System.Obsolete("Use PublicClientApplicationBuilder instead. See https://aka.ms/msal-net-3-breaking-changes. ", true)]
public PublicClientApplication (string clientId, string authority, Microsoft.Identity.Client.TokenCache userTokenCache);
[<System.Obsolete("Use PublicClientApplicationBuilder instead. See https://aka.ms/msal-net-3-breaking-changes. ", true)>]
new Microsoft.Identity.Client.PublicClientApplication : string * string * Microsoft.Identity.Client.TokenCache -> Microsoft.Identity.Client.PublicClientApplication
Public Sub New (clientId As String, authority As String, userTokenCache As TokenCache)

Parameters

clientId
String

Client id of the application

authority
String

Default authority to be used for the application

userTokenCache
TokenCache

Instance of TokenCache.

Attributes

Applies to