Table of Contents

Interface IByUsernameAndPassword

Namespace
Microsoft.Identity.Client
Assembly
Microsoft.Identity.Client.dll

Provides an explicit interface for using Resource Owner Password Grant on Confidential Client.

public interface IByUsernameAndPassword

Methods

AcquireTokenByUsernamePassword(IEnumerable<string>, string, string)

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.

AcquireTokenByUsernameAndPasswordConfidentialParameterBuilder AcquireTokenByUsernamePassword(IEnumerable<string> scopes, string username, string password)

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

AcquireTokenByUsernameAndPasswordConfidentialParameterBuilder

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.