AuthenticationContext.AcquireToken Method (String, String, Uri, PromptBehavior, UserIdentifier, String)

 

Applies to: Version: 2.19.208020213, Platform: .NET Desktop.

Acquires security token from the authority.

Namespace:   Microsoft.IdentityModel.Clients.ActiveDirectory
Assembly:  Microsoft.IdentityModel.Clients.ActiveDirectory (in Microsoft.IdentityModel.Clients.ActiveDirectory.dll)

public AuthenticationResult AcquireToken(
	string resource,
	string clientId,
	Uri redirectUri,
	PromptBehavior promptBehavior,
	UserIdentifier userId,
	string extraQueryParameters
)

Parameters

resource
Type: System.String

Identifier of the target resource that is the recipient of the requested token.

clientId
Type: System.String

Identifier of the client requesting the token.

redirectUri
Type: System.Uri

Address to return to upon receiving a response from the authority.

promptBehavior
Type: Microsoft.IdentityModel.Clients.ActiveDirectory.PromptBehavior

If Always, asks service to show user the authentication page which gives them chance to authenticate as a different user.

userId
Type: Microsoft.IdentityModel.Clients.ActiveDirectory.UserIdentifier

Identifier of the user token is requested for. If created from DisplayableId, this parameter will be used to pre-populate the username field in the authentication form. Please note that the end user can still edit the username field and authenticate as a different user. If you want to be notified of such change with an exception, create UserIdentifier with type RequiredDisplayableId. This parameter can be UserIdentifier.Any.

extraQueryParameters
Type: System.String

This parameter will be appended as is to the query string in the HTTP authentication request to the authority. The parameter can be null.

Return Value

Type: Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationResult

It contains Access Token, Refresh Token and the Access Token's expiration time.

Return to top
Show: