# Extension Grant Validator

> Documentation for the IExtensionGrantValidator interface which enables custom OAuth grant types by handling validation of extension grant requests.

#### Duende.IdentityServer.Validation.IExtensionGrantValidator

[Section titled âDuende.IdentityServer.Validation.IExtensionGrantValidatorâ](#duendeidentityservervalidationiextensiongrantvalidator)

Use an implementation of this interface to handle [extension grants](/identityserver/tokens/extension-grants/).

```csharp
public interface IExtensionGrantValidator
{
    /// <summary>
    /// Handles the custom grant request.
    /// </summary>
    /// <param name="request">The validation context.</param>
    Task ValidateAsync(ExtensionGrantValidationContext context);


    /// <summary>
    /// Returns the grant type this validator can deal with
    /// </summary>
    /// <value>
    /// The type of the grant.
    /// </value>
    string GrantType { get; }
}
```

* **`GrantType`**

  Specifies the name of the extension grant that the implementation wants to register for.

* **`ValidateAsync`**

  This method gets called at runtime, when a request comes in that is using the registered extension grant. The job of this method is to validate the request and to populate `ExtensionGrantValidationContext.Result` with a [grant validation result](/identityserver/reference/models/grant-validation-result/)

The instance of the extension grant validator gets registered with:

Program.cs

```csharp
builder.AddExtensionGrantValidator<MyValidator>();
```
-----