Share via


PublicClientApplication.AcquireTokenByUsernamePassword Method

Definition

Overloads

AcquireTokenByUsernamePassword(IEnumerable<String>, String, SecureString)
Obsolete.

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

AcquireTokenByUsernamePassword(IEnumerable<String>, String, String)
Obsolete.

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

AcquireTokenByUsernamePassword(IEnumerable<String>, String, SecureString)

Caution

This API has been deprecated, use a more secure flow. See https://aka.ms/msal-ropc-migration for migration guidance

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

[System.Obsolete("This API has been deprecated, use a more secure flow. See https://aka.ms/msal-ropc-migration for migration guidance", false)]
public Microsoft.Identity.Client.AcquireTokenByUsernamePasswordParameterBuilder AcquireTokenByUsernamePassword(System.Collections.Generic.IEnumerable<string> scopes, string username, System.Security.SecureString password);
[<System.Obsolete("This API has been deprecated, use a more secure flow. See https://aka.ms/msal-ropc-migration for migration guidance", false)>]
abstract member AcquireTokenByUsernamePassword : seq<string> * string * System.Security.SecureString -> Microsoft.Identity.Client.AcquireTokenByUsernamePasswordParameterBuilder
override this.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

Implements

Attributes

Remarks

You can also pass optional parameters by chaining the builder with: Microsoft.Identity.Client.AbstractAcquireTokenParameterBuilder`1.WithExtraQueryParameters(System.Collections.Generic.Dictionary{System.String,System.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. .NET no longer recommends using SecureString and MSAL puts the plaintext value of the password on the wire, as required by the OAuth protocol. See SecureString documentation.

Applies to

AcquireTokenByUsernamePassword(IEnumerable<String>, String, String)

Caution

This API has been deprecated, use a more secure flow. See https://aka.ms/msal-ropc-migration for migration guidance

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

[System.Obsolete("This API has been deprecated, use a more secure flow. See https://aka.ms/msal-ropc-migration for migration guidance", false)]
public Microsoft.Identity.Client.AcquireTokenByUsernamePasswordParameterBuilder AcquireTokenByUsernamePassword(System.Collections.Generic.IEnumerable<string> scopes, string username, string password);
[<System.Obsolete("This API has been deprecated, use a more secure flow. See https://aka.ms/msal-ropc-migration for migration guidance", false)>]
abstract member AcquireTokenByUsernamePassword : seq<string> * string * string -> Microsoft.Identity.Client.AcquireTokenByUsernamePasswordParameterBuilder
override this.AcquireTokenByUsernamePassword : seq<string> * string * string -> Microsoft.Identity.Client.AcquireTokenByUsernamePasswordParameterBuilder
Public Function AcquireTokenByUsernamePassword (scopes As IEnumerable(Of String), username As String, password As String) 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
String

User password as a string.

Returns

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

Implements

Attributes

Remarks

You can also pass optional parameters by chaining the builder with: Microsoft.Identity.Client.AbstractAcquireTokenParameterBuilder`1.WithExtraQueryParameters(System.Collections.Generic.Dictionary{System.String,System.String}) to pass additional query parameters to the Azure AD, 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