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

## TokenRequestValidator Class

Validates token requests against OAuth 2\.0 specifications, ensuring that requests are properly formed and authorized\.
This class plays a critical role in the OAuth 2\.0 authentication and authorization process by verifying the integrity
and authenticity of token requests, according to the framework defined in RFC 6749\.

```csharp
public class TokenRequestValidator : Abblix.Oidc.Server.Endpoints.Token.Interfaces.ITokenRequestValidator
```

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

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

## TokenRequestValidator\(ITokenContextValidator\) Constructor {#Abblix.Oidc.Server.Endpoints.Token.TokenRequestValidator.TokenRequestValidator(Abblix.Oidc.Server.Endpoints.Token.Validation.ITokenContextValidator)}

Validates token requests against OAuth 2\.0 specifications, ensuring that requests are properly formed and authorized\.
This class plays a critical role in the OAuth 2\.0 authentication and authorization process by verifying the integrity
and authenticity of token requests, according to the framework defined in RFC 6749\.

```csharp
public TokenRequestValidator(Abblix.Oidc.Server.Endpoints.Token.Validation.ITokenContextValidator validator);
```
#### Parameters

###### `validator` [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') {#Abblix.Oidc.Server.Endpoints.Token.TokenRequestValidator.TokenRequestValidator(Abblix.Oidc.Server.Endpoints.Token.Validation.ITokenContextValidator).validator}

The token context validator used to validate token requests\.
### Methods

## TokenRequestValidator\.ValidateAsync\(TokenRequest, ClientRequest\) Method {#Abblix.Oidc.Server.Endpoints.Token.TokenRequestValidator.ValidateAsync(Abblix.Oidc.Server.Model.TokenRequest,Abblix.Oidc.Server.Model.ClientRequest)}

Asynchronously validates a token request against the OAuth 2\.0 specifications\. It checks for proper authorization
of the client, the validity of the grant type, and other request parameters\. This process involves authenticating
the client using the provided client authenticator and then delegating the grant\-specific validation
to the appropriate grant handler\.

```csharp
public System.Threading.Tasks.Task<Abblix.Utils.Result<Abblix.Oidc.Server.Endpoints.Token.Interfaces.ValidTokenRequest,Abblix.Oidc.Server.Common.OidcError>> ValidateAsync(Abblix.Oidc.Server.Model.TokenRequest tokenRequest, Abblix.Oidc.Server.Model.ClientRequest clientRequest);
```
#### Parameters

###### `tokenRequest` [TokenRequest](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Model.TokenRequest 'Abblix\.Oidc\.Server\.Model\.TokenRequest') {#Abblix.Oidc.Server.Endpoints.Token.TokenRequestValidator.ValidateAsync(Abblix.Oidc.Server.Model.TokenRequest,Abblix.Oidc.Server.Model.ClientRequest).tokenRequest}

The token request containing all necessary parameters for validation\.

###### `clientRequest` [ClientRequest](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Model.ClientRequest 'Abblix\.Oidc\.Server\.Model\.ClientRequest') {#Abblix.Oidc.Server.Endpoints.Token.TokenRequestValidator.ValidateAsync(Abblix.Oidc.Server.Model.TokenRequest,Abblix.Oidc.Server.Model.ClientRequest).clientRequest}

Client request information necessary for client authentication\.

Implements [ValidateAsync\(TokenRequest, ClientRequest\)](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Endpoints.Token.Interfaces.ITokenRequestValidator#Abblix.Oidc.Server.Endpoints.Token.Interfaces.ITokenRequestValidator.ValidateAsync(Abblix.Oidc.Server.Model.TokenRequest,Abblix.Oidc.Server.Model.ClientRequest) 'Abblix\.Oidc\.Server\.Endpoints\.Token\.Interfaces\.ITokenRequestValidator\.ValidateAsync\(Abblix\.Oidc\.Server\.Model\.TokenRequest, Abblix\.Oidc\.Server\.Model\.ClientRequest\)')

#### Returns
[System\.Threading\.Tasks\.Task&lt;](https://learn.microsoft.com/en-us/dotnet/api/system.threading.tasks.task-1 'System\.Threading\.Tasks\.Task\`1')[Abblix\.Utils\.Result&lt;](https://learn.microsoft.com/en-us/dotnet/api/abblix.utils.result-2 'Abblix\.Utils\.Result\`2')[ValidTokenRequest](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Endpoints.Token.Interfaces.ValidTokenRequest 'Abblix\.Oidc\.Server\.Endpoints\.Token\.Interfaces\.ValidTokenRequest')[,](https://learn.microsoft.com/en-us/dotnet/api/abblix.utils.result-2 'Abblix\.Utils\.Result\`2')[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/abblix.utils.result-2 'Abblix\.Utils\.Result\`2')[&gt;](https://learn.microsoft.com/en-us/dotnet/api/system.threading.tasks.task-1 'System\.Threading\.Tasks\.Task\`1')  
A [System\.Threading\.Tasks\.Task](https://learn.microsoft.com/en-us/dotnet/api/system.threading.tasks.task 'System\.Threading\.Tasks\.Task') that resolves to a [Abblix\.Utils\.Result&lt;&gt;](https://learn.microsoft.com/en-us/dotnet/api/abblix.utils.result-2 'Abblix\.Utils\.Result\`2'),
            indicating the outcome of the validation process\. This result can either denote a successful validation
            or contain error information specifying why the request was invalid\.
