IPublicClientApplication.AcquireTokenByUsernamePassword(IEnumerable<String>, String, SecureString) Method

Definition

Non-interactive request to acquire a security token from the authority, via Username/Password Authentication. Available only on .net desktop and .net core. See https://aka.ms/msal-net-up for details.

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

Parameters

scopes
IEnumerable<String>

Scopes requested to access a protected API

username
String

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

password
SecureString

User password as a secure string.

Returns

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

Remarks

You can also pass optional parameters by chaining the builder with: WithExtraQueryParameters(Dictionary<String,String>) to pass additional query parameters to the STS, and one of the overrides of WithAuthority(String, Boolean) in order to override the default authority set at the application construction. Note that the overriding authority needs to be part of the known authorities added to the application construction.

Applies to