Share via


ConfidentialClientApplication.IByUsernameAndPassword.AcquireTokenByUsernamePassword Method

Definition

Acquires a token without user interaction using username and password authentication. This method does not look in the token cache, but stores the result in it. Before calling this method, use other methods such as AcquireTokenSilent(IEnumerable<String>, IAccount) to check the token cache.

Microsoft.Identity.Client.AcquireTokenByUsernameAndPasswordConfidentialParameterBuilder IByUsernameAndPassword.AcquireTokenByUsernamePassword (System.Collections.Generic.IEnumerable<string> scopes, string username, string password);
abstract member Microsoft.Identity.Client.IByUsernameAndPassword.AcquireTokenByUsernamePassword : seq<string> * string * string -> Microsoft.Identity.Client.AcquireTokenByUsernameAndPasswordConfidentialParameterBuilder
override this.Microsoft.Identity.Client.IByUsernameAndPassword.AcquireTokenByUsernamePassword : seq<string> * string * string -> Microsoft.Identity.Client.AcquireTokenByUsernameAndPasswordConfidentialParameterBuilder
Function AcquireTokenByUsernamePassword (scopes As IEnumerable(Of String), username As String, password As String) As AcquireTokenByUsernameAndPasswordConfidentialParameterBuilder Implements IByUsernameAndPassword.AcquireTokenByUsernamePassword

Parameters

scopes
IEnumerable<String>

Scopes requested to access a protected API.

username
String

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

password
String

User password as a string.

Returns

A builder enabling you to add optional parameters before executing the token request.

Implements

Applies to