#### [Abblix\.Oidc\.Server](https://www.abblix.com/en/docs/api/abblix-oidc-server 'index')
### [Abblix\.Oidc\.Server\.Endpoints\.Token\.Validation](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Endpoints.Token.Validation 'Abblix\.Oidc\.Server\.Endpoints\.Token\.Validation')

## AuthorizationGrantValidator Class

Validates the authorization grant in the context of a token request, ensuring that the request is authorized
and that the associated redirect URI matches the one used during the initial authorization request

```csharp
public class AuthorizationGrantValidator : Abblix.Oidc.Server.Endpoints.Token.Validation.ITokenContextValidator
```

Inheritance [System\.Object](https://learn.microsoft.com/en-us/dotnet/api/system.object 'System\.Object') → AuthorizationGrantValidator

Implements [ITokenContextValidator](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Endpoints.Token.Validation.ITokenContextValidator 'Abblix\.Oidc\.Server\.Endpoints\.Token\.Validation\.ITokenContextValidator')

### Remarks
This validator interacts with the [IAuthorizationGrantHandler](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Endpoints.Token.Grants.IAuthorizationGrantHandler 'Abblix\.Oidc\.Server\.Endpoints\.Token\.Grants\.IAuthorizationGrantHandler') to perform the necessary checks
on the authorization grant\. It ensures that the token request is made for an authorized grant and verifies
the consistency of the redirect URI\. If the grant is valid and authorized, it updates the validation context
### Constructors

## AuthorizationGrantValidator\(IAuthorizationGrantHandler\) Constructor {#Abblix.Oidc.Server.Endpoints.Token.Validation.AuthorizationGrantValidator.AuthorizationGrantValidator(Abblix.Oidc.Server.Endpoints.Token.Grants.IAuthorizationGrantHandler)}

Validates the authorization grant in the context of a token request, ensuring that the request is authorized
and that the associated redirect URI matches the one used during the initial authorization request

```csharp
public AuthorizationGrantValidator(Abblix.Oidc.Server.Endpoints.Token.Grants.IAuthorizationGrantHandler grantHandler);
```
#### Parameters

###### `grantHandler` [IAuthorizationGrantHandler](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Endpoints.Token.Grants.IAuthorizationGrantHandler 'Abblix\.Oidc\.Server\.Endpoints\.Token\.Grants\.IAuthorizationGrantHandler') {#Abblix.Oidc.Server.Endpoints.Token.Validation.AuthorizationGrantValidator.AuthorizationGrantValidator(Abblix.Oidc.Server.Endpoints.Token.Grants.IAuthorizationGrantHandler).grantHandler}

The handler responsible for authorizing the grant\.

### Remarks
This validator interacts with the [IAuthorizationGrantHandler](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Endpoints.Token.Grants.IAuthorizationGrantHandler 'Abblix\.Oidc\.Server\.Endpoints\.Token\.Grants\.IAuthorizationGrantHandler') to perform the necessary checks
on the authorization grant\. It ensures that the token request is made for an authorized grant and verifies
the consistency of the redirect URI\. If the grant is valid and authorized, it updates the validation context
### Methods

## AuthorizationGrantValidator\.ValidateAsync\(TokenValidationContext\) Method {#Abblix.Oidc.Server.Endpoints.Token.Validation.AuthorizationGrantValidator.ValidateAsync(Abblix.Oidc.Server.Endpoints.Token.Validation.TokenValidationContext)}

Asynchronously validates the authorization grant in the token request context\. This method checks if the grant
is valid and authorized for the client making the request\. It also ensures that the redirect URI used in the
token request matches the one used during the initial authorization request\.

```csharp
public System.Threading.Tasks.Task<Abblix.Oidc.Server.Common.OidcError?> ValidateAsync(Abblix.Oidc.Server.Endpoints.Token.Validation.TokenValidationContext context);
```
#### Parameters

###### `context` [TokenValidationContext](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Endpoints.Token.Validation.TokenValidationContext 'Abblix\.Oidc\.Server\.Endpoints\.Token\.Validation\.TokenValidationContext') {#Abblix.Oidc.Server.Endpoints.Token.Validation.AuthorizationGrantValidator.ValidateAsync(Abblix.Oidc.Server.Endpoints.Token.Validation.TokenValidationContext).context}

The validation context containing the token request and client information\.

Implements [ValidateAsync\(TokenValidationContext\)](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Endpoints.Token.Validation.ITokenContextValidator#Abblix.Oidc.Server.Endpoints.Token.Validation.ITokenContextValidator.ValidateAsync(Abblix.Oidc.Server.Endpoints.Token.Validation.TokenValidationContext) 'Abblix\.Oidc\.Server\.Endpoints\.Token\.Validation\.ITokenContextValidator\.ValidateAsync\(Abblix\.Oidc\.Server\.Endpoints\.Token\.Validation\.TokenValidationContext\)')

#### Returns
[System\.Threading\.Tasks\.Task&lt;](https://learn.microsoft.com/en-us/dotnet/api/system.threading.tasks.task-1 'System\.Threading\.Tasks\.Task\`1')[OidcError](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Common.OidcError 'Abblix\.Oidc\.Server\.Common\.OidcError')[&gt;](https://learn.microsoft.com/en-us/dotnet/api/system.threading.tasks.task-1 'System\.Threading\.Tasks\.Task\`1')  
A [OidcError](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Common.OidcError 'Abblix\.Oidc\.Server\.Common\.OidcError') if the authorization grant is invalid,
including an error code and description;
otherwise, null indicating that the grant is valid and the context has been updated\.
