IAuthorizationHeaderProvider2.CreateAuthorizationHeaderInformationForAppAsync Method
Definition
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.
Rich-result counterpart of CreateAuthorizationHeaderForAppAsync(String, AuthorizationHeaderProviderOptions, CancellationToken): creates the authorization header used to call a protected web API on behalf of the application itself and returns the full AuthorizationHeaderInformation on success, with metadata and (when the protocol is bound) the binding certificate populated. On failure the AuthorizationHeaderError carries the token-acquisition metadata and structured failure details when available.
public System.Threading.Tasks.Task<Microsoft.Identity.Abstractions.OperationResult<Microsoft.Identity.Abstractions.AuthorizationHeaderInformation,Microsoft.Identity.Abstractions.AuthorizationHeaderError>> CreateAuthorizationHeaderInformationForAppAsync(string scopes, Microsoft.Identity.Abstractions.AuthorizationHeaderProviderOptions? downstreamApiOptions = default, System.Threading.CancellationToken cancellationToken = default);
abstract member CreateAuthorizationHeaderInformationForAppAsync : string * Microsoft.Identity.Abstractions.AuthorizationHeaderProviderOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Identity.Abstractions.OperationResult<Microsoft.Identity.Abstractions.AuthorizationHeaderInformation, Microsoft.Identity.Abstractions.AuthorizationHeaderError>>
Public Function CreateAuthorizationHeaderInformationForAppAsync (scopes As String, Optional downstreamApiOptions As AuthorizationHeaderProviderOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of OperationResult(Of AuthorizationHeaderInformation, AuthorizationHeaderError))
Parameters
- scopes
- String
Scopes for which to request the authorization header.
- downstreamApiOptions
- AuthorizationHeaderProviderOptions
Information about the API that will be called (for some protocols like PoP), and token acquisition options. Optional. If not provided, the authorization header will be for a bearer token.
- cancellationToken
- CancellationToken
Cancellation token.
Returns
An OperationResult<TResult,TError> containing the AuthorizationHeaderInformation on success, or an AuthorizationHeaderError on failure.