Delegate AuthorizationRedirectDelegate
- Namespace
- ModelContextProtocol.Authentication
- Assembly
- ModelContextProtocol.Core.dll
Represents a method that handles the OAuth authorization URL and returns the authorization code.
[Obsolete("AuthorizationRedirectDelegate cannot provide the RFC 9207 issuer and is retained for compatibility only. Use AuthorizationCallbackHandler instead.", DiagnosticId = "MCP9007", UrlFormat = "https://github.com/modelcontextprotocol/csharp-sdk/blob/main/docs/list-of-diagnostics.md#obsolete-apis")]
public delegate Task<string?> AuthorizationRedirectDelegate(Uri authorizationUri, Uri redirectUri, CancellationToken cancellationToken)
Parameters
authorizationUriUriThe authorization URL that the user needs to visit.
redirectUriUriThe redirect URI where the authorization code will be sent.
cancellationTokenCancellationTokenThe CancellationToken to monitor for cancellation requests. The default is None.
Returns
- Task<string>
A task that represents the asynchronous operation. The task result contains the authorization code if successful, or null if the operation failed or was cancelled.
Remarks
This delegate cannot return the iss parameter from the authorization response, so
RFC 9207 issuer validation is
skipped when it is used. Use AuthorizationCallbackHandler for
issuer-aware authorization flows.