IPublicClientApplication.AcquireTokenAsync Method

Definition

Overloads

AcquireTokenAsync(IEnumerable<String>)

Interactive request to acquire token for the specified scopes. The user is required to select an account

AcquireTokenAsync(IEnumerable<String>, String, Prompt, String, IEnumerable<String>, String, UIParent)

Interactive request to acquire token for a given login, with the possibility of controlling the user experience, passing extra query parameters, providing extra scopes that the user can pre-consent to, and overriding the authority pre-configured in the application

AcquireTokenAsync(IEnumerable<String>, String, Prompt, String, IEnumerable<String>, String)

Interactive request to acquire token for a given login, with the possibility of controlling the user experience, passing extra query parameters, providing extra scopes that the user can pre-consent to, and overriding the authority pre-configured in the application

AcquireTokenAsync(IEnumerable<String>, IAccount, Prompt, String, IEnumerable<String>, String)

Interactive request to acquire token for a given account, with the possibility of controlling the user experience, passing extra query parameters, providing extra scopes that the user can pre-consent to, and overriding the authority pre-configured in the application

AcquireTokenAsync(IEnumerable<String>, String, Prompt, String, UIParent)

Interactive request to acquire token for a login with control of the UI behavior and possiblity of passing extra query parameters like additional claims

AcquireTokenAsync(IEnumerable<String>, IAccount, Prompt, String, UIParent)

Interactive request to acquire token for an account with control of the UI behavior and possiblity of passing extra query parameters like additional claims

AcquireTokenAsync(IEnumerable<String>, String, Prompt, String)

Interactive request to acquire token for a login with control of the UI behavior and possiblity of passing extra query parameters like additional claims

AcquireTokenAsync(IEnumerable<String>, IAccount, Prompt, String, IEnumerable<String>, String, UIParent)

Interactive request to acquire token for a given account, with the possibility of controlling the user experience, passing extra query parameters, providing extra scopes that the user can pre-consent to, and overriding the authority pre-configured in the application

AcquireTokenAsync(IEnumerable<String>, String, UIParent)

Interactive request to acquire token for the specified scopes. The interactive window will be parented to the specified window. . The user will need to sign-in but an account will be proposed based on the loginHint

AcquireTokenAsync(IEnumerable<String>, IAccount, UIParent)

Interactive request to acquire token for the specified scopes. The user will need to sign-in but an account will be proposed based on the provided account

AcquireTokenAsync(IEnumerable<String>, String)

Interactive request to acquire token for the specified scopes. The user will need to sign-in but an account will be proposed based on the loginHint

AcquireTokenAsync(IEnumerable<String>, UIParent)

Interactive request to acquire token for the specified scopes. The interactive window will be parented to the specified window. The user will be required to select an account

AcquireTokenAsync(IEnumerable<String>, IAccount, Prompt, String)

Interactive request to acquire token for an account with control of the UI behavior and possiblity of passing extra query parameters like additional claims

AcquireTokenAsync(IEnumerable<String>, IAccount)

Interactive request to acquire token for the specified scopes. The user will need to sign-in but an account will be proposed based on the provided account

AcquireTokenAsync(IEnumerable<String>)

Warning

This API is now obsolete.

Interactive request to acquire token for the specified scopes. The user is required to select an account

[System.Obsolete("Use AcquireTokenInteractive instead. See https://aka.ms/msal-net-3-breaking-changes", true)]
public System.Threading.Tasks.Task<Microsoft.Identity.Client.AuthenticationResult> AcquireTokenAsync (System.Collections.Generic.IEnumerable<string> scopes);
abstract member AcquireTokenAsync : seq<string> -> System.Threading.Tasks.Task<Microsoft.Identity.Client.AuthenticationResult>
Public Function AcquireTokenAsync (scopes As IEnumerable(Of String)) As Task(Of AuthenticationResult)

Parameters

scopes
IEnumerable<String>

Scopes requested to access a protected API

Returns

Authentication result containing a token for the requested scopes and account

Attributes

Remarks

The user will be signed-in interactively if needed,

        and will consent to scopes and do multi-factor authentication if such a policy was enabled in the Azure AD tenant.

AcquireTokenAsync(IEnumerable<String>, String, Prompt, String, IEnumerable<String>, String, UIParent)

Warning

This API is now obsolete.

Interactive request to acquire token for a given login, with the possibility of controlling the user experience, passing extra query parameters, providing extra scopes that the user can pre-consent to, and overriding the authority pre-configured in the application

[System.Obsolete("Use AcquireTokenInteractive instead. See https://aka.ms/msal-net-3-breaking-changes", true)]
public System.Threading.Tasks.Task<Microsoft.Identity.Client.AuthenticationResult> AcquireTokenAsync (System.Collections.Generic.IEnumerable<string> scopes, string loginHint, Microsoft.Identity.Client.Prompt prompt, string extraQueryParameters, System.Collections.Generic.IEnumerable<string> extraScopesToConsent, string authority, Microsoft.Identity.Client.UIParent parent);
abstract member AcquireTokenAsync : seq<string> * string * Microsoft.Identity.Client.Prompt * string * seq<string> * string * Microsoft.Identity.Client.UIParent -> System.Threading.Tasks.Task<Microsoft.Identity.Client.AuthenticationResult>

Parameters

scopes
IEnumerable<String>

Scopes requested to access a protected API

loginHint
String

Identifier of the user. Generally in UserPrincipalName (UPN) format, e.g. john.doe@contoso.com

prompt
Prompt

Designed interactive experience for the user.

extraQueryParameters
String

This parameter will be appended as is to the query string in the HTTP authentication request to the authority. This is expected to be a string of segments of the form key=value separated by an ampersand character. The parameter can be null.

extraScopesToConsent
IEnumerable<String>

Scopes that you can request the end user to consent upfront, in addition to the scopes for the protected Web API for which you want to acquire a security token.

authority
String

Specific authority for which the token is requested. Passing a different value than configured does not change the configured value

parent
UIParent

Object containing a reference to the parent window/activity. REQUIRED for Xamarin.Android only.

Returns

Authentication result containing a token for the requested scopes and account

Attributes

AcquireTokenAsync(IEnumerable<String>, String, Prompt, String, IEnumerable<String>, String)

Warning

This API is now obsolete.

Interactive request to acquire token for a given login, with the possibility of controlling the user experience, passing extra query parameters, providing extra scopes that the user can pre-consent to, and overriding the authority pre-configured in the application

[System.Obsolete("Use AcquireTokenInteractive instead. See https://aka.ms/msal-net-3-breaking-changes", true)]
public System.Threading.Tasks.Task<Microsoft.Identity.Client.AuthenticationResult> AcquireTokenAsync (System.Collections.Generic.IEnumerable<string> scopes, string loginHint, Microsoft.Identity.Client.Prompt prompt, string extraQueryParameters, System.Collections.Generic.IEnumerable<string> extraScopesToConsent, string authority);
abstract member AcquireTokenAsync : seq<string> * string * Microsoft.Identity.Client.Prompt * string * seq<string> * string -> System.Threading.Tasks.Task<Microsoft.Identity.Client.AuthenticationResult>

Parameters

scopes
IEnumerable<String>

scopes requested to access a protected API

loginHint
String

Identifier of the user. Generally in UserPrincipalName (UPN) format, e.g. john.doe@contoso.com

prompt
Prompt

Designed interactive experience for the user.

extraQueryParameters
String

This parameter will be appended as is to the query string in the HTTP authentication request to the authority. This is expected to be a string of segments of the form key=value separated by an ampersand character. The parameter can be null.

extraScopesToConsent
IEnumerable<String>

scopes that you can request the end user to consent upfront, in addition to the scopes for the protected Web API for which you want to acquire a security token.

authority
String

Specific authority for which the token is requested. Passing a different value than configured does not change the configured value

Returns

Authentication result containing a token for the requested scopes and account

Attributes

AcquireTokenAsync(IEnumerable<String>, IAccount, Prompt, String, IEnumerable<String>, String)

Warning

This API is now obsolete.

Interactive request to acquire token for a given account, with the possibility of controlling the user experience, passing extra query parameters, providing extra scopes that the user can pre-consent to, and overriding the authority pre-configured in the application

[System.Obsolete("Use AcquireTokenInteractive instead. See https://aka.ms/msal-net-3-breaking-changes", true)]
public System.Threading.Tasks.Task<Microsoft.Identity.Client.AuthenticationResult> AcquireTokenAsync (System.Collections.Generic.IEnumerable<string> scopes, Microsoft.Identity.Client.IAccount account, Microsoft.Identity.Client.Prompt prompt, string extraQueryParameters, System.Collections.Generic.IEnumerable<string> extraScopesToConsent, string authority);
abstract member AcquireTokenAsync : seq<string> * Microsoft.Identity.Client.IAccount * Microsoft.Identity.Client.Prompt * string * seq<string> * string -> System.Threading.Tasks.Task<Microsoft.Identity.Client.AuthenticationResult>

Parameters

scopes
IEnumerable<String>

Scopes requested to access a protected API

account
IAccount

Account to use for the interactive token acquisition. See IAccount for ways to get an account

prompt
Prompt

Designed interactive experience for the user.

extraQueryParameters
String

This parameter will be appended as is to the query string in the HTTP authentication request to the authority. This is expected to be a string of segments of the form key=value separated by an ampersand character. The parameter can be null.

extraScopesToConsent
IEnumerable<String>

Scopes that you can request the end user to consent upfront, in addition to the scopes for the protected Web API for which you want to acquire a security token.

authority
String

Specific authority for which the token is requested. Passing a different value than configured does not change the configured value

Returns

Authentication result containing a token for the requested scopes and account

Attributes

AcquireTokenAsync(IEnumerable<String>, String, Prompt, String, UIParent)

Warning

This API is now obsolete.

Interactive request to acquire token for a login with control of the UI behavior and possiblity of passing extra query parameters like additional claims

[System.Obsolete("Use AcquireTokenInteractive instead. See https://aka.ms/msal-net-3-breaking-changes", true)]
public System.Threading.Tasks.Task<Microsoft.Identity.Client.AuthenticationResult> AcquireTokenAsync (System.Collections.Generic.IEnumerable<string> scopes, string loginHint, Microsoft.Identity.Client.Prompt prompt, string extraQueryParameters, Microsoft.Identity.Client.UIParent parent);
abstract member AcquireTokenAsync : seq<string> * string * Microsoft.Identity.Client.Prompt * string * Microsoft.Identity.Client.UIParent -> System.Threading.Tasks.Task<Microsoft.Identity.Client.AuthenticationResult>

Parameters

scopes
IEnumerable<String>

Scopes requested to access a protected API

loginHint
String

Identifier of the user. Generally in UserPrincipalName (UPN) format, e.g. john.doe@contoso.com

prompt
Prompt

Designed interactive experience for the user.

extraQueryParameters
String

This parameter will be appended as is to the query string in the HTTP authentication request to the authority. This is expected to be a string of segments of the form key=value separated by an ampersand character. The parameter can be null.

parent
UIParent

Object containing a reference to the parent window/activity. REQUIRED for Xamarin.Android only.

Returns

Authentication result containing a token for the requested scopes and account

Attributes

AcquireTokenAsync(IEnumerable<String>, IAccount, Prompt, String, UIParent)

Warning

This API is now obsolete.

Interactive request to acquire token for an account with control of the UI behavior and possiblity of passing extra query parameters like additional claims

[System.Obsolete("Use AcquireTokenInteractive instead. See https://aka.ms/msal-net-3-breaking-changes", true)]
public System.Threading.Tasks.Task<Microsoft.Identity.Client.AuthenticationResult> AcquireTokenAsync (System.Collections.Generic.IEnumerable<string> scopes, Microsoft.Identity.Client.IAccount account, Microsoft.Identity.Client.Prompt prompt, string extraQueryParameters, Microsoft.Identity.Client.UIParent parent);
abstract member AcquireTokenAsync : seq<string> * Microsoft.Identity.Client.IAccount * Microsoft.Identity.Client.Prompt * string * Microsoft.Identity.Client.UIParent -> System.Threading.Tasks.Task<Microsoft.Identity.Client.AuthenticationResult>

Parameters

scopes
IEnumerable<String>

Scopes requested to access a protected API

account
IAccount

Account to use for the interactive token acquisition. See IAccount for ways to get an account

prompt
Prompt

Designed interactive experience for the user.

extraQueryParameters
String

This parameter will be appended as is to the query string in the HTTP authentication request to the authority. This is expected to be a string of segments of the form key=value separated by an ampersand character. The parameter can be null.

parent
UIParent

Object containing a reference to the parent window/activity. REQUIRED for Xamarin.Android only.

Returns

Authentication result containing a token for the requested scopes and account

Attributes

AcquireTokenAsync(IEnumerable<String>, String, Prompt, String)

Warning

This API is now obsolete.

Interactive request to acquire token for a login with control of the UI behavior and possiblity of passing extra query parameters like additional claims

[System.Obsolete("Use AcquireTokenInteractive instead. See https://aka.ms/msal-net-3-breaking-changes", true)]
public System.Threading.Tasks.Task<Microsoft.Identity.Client.AuthenticationResult> AcquireTokenAsync (System.Collections.Generic.IEnumerable<string> scopes, string loginHint, Microsoft.Identity.Client.Prompt prompt, string extraQueryParameters);
abstract member AcquireTokenAsync : seq<string> * string * Microsoft.Identity.Client.Prompt * string -> System.Threading.Tasks.Task<Microsoft.Identity.Client.AuthenticationResult>

Parameters

scopes
IEnumerable<String>

Scopes requested to access a protected API

loginHint
String

Identifier of the user. Generally in UserPrincipalName (UPN) format, e.g. john.doe@contoso.com

prompt
Prompt

Designed interactive experience for the user.

extraQueryParameters
String

This parameter will be appended as is to the query string in the HTTP authentication request to the authority. This is expected to be a string of segments of the form key=value separated by an ampersand character. The parameter can be null.

Returns

Authentication result containing a token for the requested scopes and account

Attributes

AcquireTokenAsync(IEnumerable<String>, IAccount, Prompt, String, IEnumerable<String>, String, UIParent)

Warning

This API is now obsolete.

Interactive request to acquire token for a given account, with the possibility of controlling the user experience, passing extra query parameters, providing extra scopes that the user can pre-consent to, and overriding the authority pre-configured in the application

[System.Obsolete("Use AcquireTokenInteractive instead. See https://aka.ms/msal-net-3-breaking-changes", true)]
public System.Threading.Tasks.Task<Microsoft.Identity.Client.AuthenticationResult> AcquireTokenAsync (System.Collections.Generic.IEnumerable<string> scopes, Microsoft.Identity.Client.IAccount account, Microsoft.Identity.Client.Prompt prompt, string extraQueryParameters, System.Collections.Generic.IEnumerable<string> extraScopesToConsent, string authority, Microsoft.Identity.Client.UIParent parent);
abstract member AcquireTokenAsync : seq<string> * Microsoft.Identity.Client.IAccount * Microsoft.Identity.Client.Prompt * string * seq<string> * string * Microsoft.Identity.Client.UIParent -> System.Threading.Tasks.Task<Microsoft.Identity.Client.AuthenticationResult>

Parameters

scopes
IEnumerable<String>

Scopes requested to access a protected API

account
IAccount

Account to use for the interactive token acquisition. See IAccount for ways to get an account

prompt
Prompt

Designed interactive experience for the user.

extraQueryParameters
String

This parameter will be appended as is to the query string in the HTTP authentication request to the authority. This is expected to be a string of segments of the form key=value separated by an ampersand character. The parameter can be null.

extraScopesToConsent
IEnumerable<String>

Scopes that you can request the end user to consent upfront, in addition to the scopes for the protected Web API for which you want to acquire a security token.

authority
String

Specific authority for which the token is requested. Passing a different value than configured does not change the configured value

parent
UIParent

Object containing a reference to the parent window/activity. REQUIRED for Xamarin.Android only.

Returns

Authentication result containing a token for the requested scopes and account

Attributes

AcquireTokenAsync(IEnumerable<String>, String, UIParent)

Warning

This API is now obsolete.

Interactive request to acquire token for the specified scopes. The interactive window will be parented to the specified window. . The user will need to sign-in but an account will be proposed based on the loginHint

[System.Obsolete("Use AcquireTokenInteractive instead. See https://aka.ms/msal-net-3-breaking-changes", true)]
public System.Threading.Tasks.Task<Microsoft.Identity.Client.AuthenticationResult> AcquireTokenAsync (System.Collections.Generic.IEnumerable<string> scopes, string loginHint, Microsoft.Identity.Client.UIParent parent);
abstract member AcquireTokenAsync : seq<string> * string * Microsoft.Identity.Client.UIParent -> System.Threading.Tasks.Task<Microsoft.Identity.Client.AuthenticationResult>
Public Function AcquireTokenAsync (scopes As IEnumerable(Of String), loginHint As String, parent As UIParent) As Task(Of AuthenticationResult)

Parameters

scopes
IEnumerable<String>

Scopes requested to access a protected API

loginHint
String

Identifier of the user. Generally in UserPrincipalName (UPN) format, e.g. john.doe@contoso.com

parent
UIParent

Object containing a reference to the parent window/activity. REQUIRED for Xamarin.Android only.

Returns

Authentication result containing a token for the requested scopes and login

Attributes

AcquireTokenAsync(IEnumerable<String>, IAccount, UIParent)

Warning

This API is now obsolete.

Interactive request to acquire token for the specified scopes. The user will need to sign-in but an account will be proposed based on the provided account

[System.Obsolete("Use AcquireTokenInteractive instead. See https://aka.ms/msal-net-3-breaking-changes", true)]
public System.Threading.Tasks.Task<Microsoft.Identity.Client.AuthenticationResult> AcquireTokenAsync (System.Collections.Generic.IEnumerable<string> scopes, Microsoft.Identity.Client.IAccount account, Microsoft.Identity.Client.UIParent parent);
abstract member AcquireTokenAsync : seq<string> * Microsoft.Identity.Client.IAccount * Microsoft.Identity.Client.UIParent -> System.Threading.Tasks.Task<Microsoft.Identity.Client.AuthenticationResult>
Public Function AcquireTokenAsync (scopes As IEnumerable(Of String), account As IAccount, parent As UIParent) As Task(Of AuthenticationResult)

Parameters

scopes
IEnumerable<String>

Scopes requested to access a protected API

account
IAccount

Account to use for the interactive token acquisition. See IAccount for ways to get an account

parent
UIParent

Object containing a reference to the parent window/activity. REQUIRED for Xamarin.Android only.

Returns

Authentication result containing a token for the requested scopes and account

Attributes

AcquireTokenAsync(IEnumerable<String>, String)

Warning

This API is now obsolete.

Interactive request to acquire token for the specified scopes. The user will need to sign-in but an account will be proposed based on the loginHint

[System.Obsolete("Use AcquireTokenInteractive instead. See https://aka.ms/msal-net-3-breaking-changes", true)]
public System.Threading.Tasks.Task<Microsoft.Identity.Client.AuthenticationResult> AcquireTokenAsync (System.Collections.Generic.IEnumerable<string> scopes, string loginHint);
abstract member AcquireTokenAsync : seq<string> * string -> System.Threading.Tasks.Task<Microsoft.Identity.Client.AuthenticationResult>
Public Function AcquireTokenAsync (scopes As IEnumerable(Of String), loginHint As String) As Task(Of AuthenticationResult)

Parameters

scopes
IEnumerable<String>

Scopes requested to access a protected API

loginHint
String

Identifier of the user. Generally in UserPrincipalName (UPN) format, e.g. john.doe@contoso.com

Returns

Authentication result containing a token for the requested scopes and account

Attributes

AcquireTokenAsync(IEnumerable<String>, UIParent)

Warning

This API is now obsolete.

Interactive request to acquire token for the specified scopes. The interactive window will be parented to the specified window. The user will be required to select an account

[System.Obsolete("Use AcquireTokenInteractive instead. See https://aka.ms/msal-net-3-breaking-changes", true)]
public System.Threading.Tasks.Task<Microsoft.Identity.Client.AuthenticationResult> AcquireTokenAsync (System.Collections.Generic.IEnumerable<string> scopes, Microsoft.Identity.Client.UIParent parent);
abstract member AcquireTokenAsync : seq<string> * Microsoft.Identity.Client.UIParent -> System.Threading.Tasks.Task<Microsoft.Identity.Client.AuthenticationResult>
Public Function AcquireTokenAsync (scopes As IEnumerable(Of String), parent As UIParent) As Task(Of AuthenticationResult)

Parameters

scopes
IEnumerable<String>

Scopes requested to access a protected API

parent
UIParent

Object containing a reference to the parent window/activity. REQUIRED for Xamarin.Android only.

Returns

Authentication result containing a token for the requested scopes and account

Attributes

Remarks

The user will be signed-in interactively if needed,

        and will consent to scopes and do multi-factor authentication if such a policy was enabled in the Azure AD tenant.

AcquireTokenAsync(IEnumerable<String>, IAccount, Prompt, String)

Warning

This API is now obsolete.

Interactive request to acquire token for an account with control of the UI behavior and possiblity of passing extra query parameters like additional claims

[System.Obsolete("Use AcquireTokenInteractive instead. See https://aka.ms/msal-net-3-breaking-changes", true)]
public System.Threading.Tasks.Task<Microsoft.Identity.Client.AuthenticationResult> AcquireTokenAsync (System.Collections.Generic.IEnumerable<string> scopes, Microsoft.Identity.Client.IAccount account, Microsoft.Identity.Client.Prompt prompt, string extraQueryParameters);
abstract member AcquireTokenAsync : seq<string> * Microsoft.Identity.Client.IAccount * Microsoft.Identity.Client.Prompt * string -> System.Threading.Tasks.Task<Microsoft.Identity.Client.AuthenticationResult>

Parameters

scopes
IEnumerable<String>

Scopes requested to access a protected API

account
IAccount

Account to use for the interactive token acquisition. See IAccount for ways to get an account

prompt
Prompt

Designed interactive experience for the user.

extraQueryParameters
String

This parameter will be appended as is to the query string in the HTTP authentication request to the authority. This is expected to be a string of segments of the form key=value separated by an ampersand character. The parameter can be null.

Returns

Authentication result containing a token for the requested scopes and account

Attributes

AcquireTokenAsync(IEnumerable<String>, IAccount)

Warning

This API is now obsolete.

Interactive request to acquire token for the specified scopes. The user will need to sign-in but an account will be proposed based on the provided account

[System.Obsolete("Use AcquireTokenInteractive instead. See https://aka.ms/msal-net-3-breaking-changes", true)]
public System.Threading.Tasks.Task<Microsoft.Identity.Client.AuthenticationResult> AcquireTokenAsync (System.Collections.Generic.IEnumerable<string> scopes, Microsoft.Identity.Client.IAccount account);
abstract member AcquireTokenAsync : seq<string> * Microsoft.Identity.Client.IAccount -> System.Threading.Tasks.Task<Microsoft.Identity.Client.AuthenticationResult>
Public Function AcquireTokenAsync (scopes As IEnumerable(Of String), account As IAccount) As Task(Of AuthenticationResult)

Parameters

scopes
IEnumerable<String>

Scopes requested to access a protected API

account
IAccount

Account to use for the interactive token acquisition. See IAccount for ways to get an account

Returns

Authentication result containing a token for the requested scopes and account

Attributes

Applies to