Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

IByUsernameAndPassword.AcquireTokenByUsernamePassword Method

Definition

Namespace:
Microsoft.Identity.Client
Assembly:
Microsoft.Identity.Client.dll
Package:
Microsoft.Identity.Client v4.83.3

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

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.

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

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.

Remarks

Available only for .NET Framework and .NET Core applications. See our documentation for details.

Applies to


Feedback

Was this page helpful?