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

## UserCodeVerificationService Class

Implements the user code verification service for the Device Authorization Grant flow \(RFC 8628\)\.
This service handles the verification, approval, and denial of device authorization requests
with built\-in brute force protection\.

```csharp
public class UserCodeVerificationService : Abblix.Oidc.Server.Features.DeviceAuthorization.Interfaces.IUserCodeVerificationService
```

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

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

## UserCodeVerificationService\(IDeviceAuthorizationStorage, IUserCodeRateLimiter, IUserCodeNormalizer, IHttpContextAccessor, TimeProvider\) Constructor {#Abblix.Oidc.Server.Features.DeviceAuthorization.UserCodeVerificationService.UserCodeVerificationService(Abblix.Oidc.Server.Features.DeviceAuthorization.Interfaces.IDeviceAuthorizationStorage,Abblix.Oidc.Server.Features.DeviceAuthorization.Interfaces.IUserCodeRateLimiter,Abblix.Oidc.Server.Features.DeviceAuthorization.Interfaces.IUserCodeNormalizer,Microsoft.AspNetCore.Http.IHttpContextAccessor,System.TimeProvider)}

Implements the user code verification service for the Device Authorization Grant flow \(RFC 8628\)\.
This service handles the verification, approval, and denial of device authorization requests
with built\-in brute force protection\.

```csharp
public UserCodeVerificationService(Abblix.Oidc.Server.Features.DeviceAuthorization.Interfaces.IDeviceAuthorizationStorage storage, Abblix.Oidc.Server.Features.DeviceAuthorization.Interfaces.IUserCodeRateLimiter rateLimiter, Abblix.Oidc.Server.Features.DeviceAuthorization.Interfaces.IUserCodeNormalizer normalizer, Microsoft.AspNetCore.Http.IHttpContextAccessor httpContextAccessor, System.TimeProvider timeProvider);
```
#### Parameters

###### `storage` [IDeviceAuthorizationStorage](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Features.DeviceAuthorization.Interfaces.IDeviceAuthorizationStorage 'Abblix\.Oidc\.Server\.Features\.DeviceAuthorization\.Interfaces\.IDeviceAuthorizationStorage') {#Abblix.Oidc.Server.Features.DeviceAuthorization.UserCodeVerificationService.UserCodeVerificationService(Abblix.Oidc.Server.Features.DeviceAuthorization.Interfaces.IDeviceAuthorizationStorage,Abblix.Oidc.Server.Features.DeviceAuthorization.Interfaces.IUserCodeRateLimiter,Abblix.Oidc.Server.Features.DeviceAuthorization.Interfaces.IUserCodeNormalizer,Microsoft.AspNetCore.Http.IHttpContextAccessor,System.TimeProvider).storage}

The storage service for device authorization requests\.

###### `rateLimiter` [IUserCodeRateLimiter](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Features.DeviceAuthorization.Interfaces.IUserCodeRateLimiter 'Abblix\.Oidc\.Server\.Features\.DeviceAuthorization\.Interfaces\.IUserCodeRateLimiter') {#Abblix.Oidc.Server.Features.DeviceAuthorization.UserCodeVerificationService.UserCodeVerificationService(Abblix.Oidc.Server.Features.DeviceAuthorization.Interfaces.IDeviceAuthorizationStorage,Abblix.Oidc.Server.Features.DeviceAuthorization.Interfaces.IUserCodeRateLimiter,Abblix.Oidc.Server.Features.DeviceAuthorization.Interfaces.IUserCodeNormalizer,Microsoft.AspNetCore.Http.IHttpContextAccessor,System.TimeProvider).rateLimiter}

The rate limiter for preventing brute force attacks\.

###### `normalizer` [IUserCodeNormalizer](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Features.DeviceAuthorization.Interfaces.IUserCodeNormalizer 'Abblix\.Oidc\.Server\.Features\.DeviceAuthorization\.Interfaces\.IUserCodeNormalizer') {#Abblix.Oidc.Server.Features.DeviceAuthorization.UserCodeVerificationService.UserCodeVerificationService(Abblix.Oidc.Server.Features.DeviceAuthorization.Interfaces.IDeviceAuthorizationStorage,Abblix.Oidc.Server.Features.DeviceAuthorization.Interfaces.IUserCodeRateLimiter,Abblix.Oidc.Server.Features.DeviceAuthorization.Interfaces.IUserCodeNormalizer,Microsoft.AspNetCore.Http.IHttpContextAccessor,System.TimeProvider).normalizer}

Canonicalizes user\-entered codes before lookup \(RFC 8628 Section 6\.1\)\.

###### `httpContextAccessor` [Microsoft\.AspNetCore\.Http\.IHttpContextAccessor](https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.http.ihttpcontextaccessor 'Microsoft\.AspNetCore\.Http\.IHttpContextAccessor') {#Abblix.Oidc.Server.Features.DeviceAuthorization.UserCodeVerificationService.UserCodeVerificationService(Abblix.Oidc.Server.Features.DeviceAuthorization.Interfaces.IDeviceAuthorizationStorage,Abblix.Oidc.Server.Features.DeviceAuthorization.Interfaces.IUserCodeRateLimiter,Abblix.Oidc.Server.Features.DeviceAuthorization.Interfaces.IUserCodeNormalizer,Microsoft.AspNetCore.Http.IHttpContextAccessor,System.TimeProvider).httpContextAccessor}

Accessor for the current HTTP context to retrieve client IP\.

###### `timeProvider` [System\.TimeProvider](https://learn.microsoft.com/en-us/dotnet/api/system.timeprovider 'System\.TimeProvider') {#Abblix.Oidc.Server.Features.DeviceAuthorization.UserCodeVerificationService.UserCodeVerificationService(Abblix.Oidc.Server.Features.DeviceAuthorization.Interfaces.IDeviceAuthorizationStorage,Abblix.Oidc.Server.Features.DeviceAuthorization.Interfaces.IUserCodeRateLimiter,Abblix.Oidc.Server.Features.DeviceAuthorization.Interfaces.IUserCodeNormalizer,Microsoft.AspNetCore.Http.IHttpContextAccessor,System.TimeProvider).timeProvider}

Provides the current time for deriving the request's remaining lifetime\.
### Methods

## UserCodeVerificationService\.ApproveAsync\(string, AuthorizedGrant\) Method {#Abblix.Oidc.Server.Features.DeviceAuthorization.UserCodeVerificationService.ApproveAsync(string,Abblix.Oidc.Server.Endpoints.Token.Interfaces.AuthorizedGrant)}

Approves the device authorization request, linking the user's authorization to the pending device\.

```csharp
public System.Threading.Tasks.Task<bool> ApproveAsync(string userCode, Abblix.Oidc.Server.Endpoints.Token.Interfaces.AuthorizedGrant authorizedGrant);
```
#### Parameters

###### `userCode` [System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String') {#Abblix.Oidc.Server.Features.DeviceAuthorization.UserCodeVerificationService.ApproveAsync(string,Abblix.Oidc.Server.Endpoints.Token.Interfaces.AuthorizedGrant).userCode}

The user\-entered verification code\.

###### `authorizedGrant` [AuthorizedGrant](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Endpoints.Token.Interfaces.AuthorizedGrant 'Abblix\.Oidc\.Server\.Endpoints\.Token\.Interfaces\.AuthorizedGrant') {#Abblix.Oidc.Server.Features.DeviceAuthorization.UserCodeVerificationService.ApproveAsync(string,Abblix.Oidc.Server.Endpoints.Token.Interfaces.AuthorizedGrant).authorizedGrant}

The authorized grant containing the user's authentication session and context\.

Implements [ApproveAsync\(string, AuthorizedGrant\)](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Features.DeviceAuthorization.Interfaces.IUserCodeVerificationService#Abblix.Oidc.Server.Features.DeviceAuthorization.Interfaces.IUserCodeVerificationService.ApproveAsync(string,Abblix.Oidc.Server.Endpoints.Token.Interfaces.AuthorizedGrant) 'Abblix\.Oidc\.Server\.Features\.DeviceAuthorization\.Interfaces\.IUserCodeVerificationService\.ApproveAsync\(string, Abblix\.Oidc\.Server\.Endpoints\.Token\.Interfaces\.AuthorizedGrant\)')

#### Returns
[System\.Threading\.Tasks\.Task&lt;](https://learn.microsoft.com/en-us/dotnet/api/system.threading.tasks.task-1 'System\.Threading\.Tasks\.Task\`1')[System\.Boolean](https://learn.microsoft.com/en-us/dotnet/api/system.boolean 'System\.Boolean')[&gt;](https://learn.microsoft.com/en-us/dotnet/api/system.threading.tasks.task-1 'System\.Threading\.Tasks\.Task\`1')  
A task that returns true if the approval was successful; false if the code is invalid or expired\.

## UserCodeVerificationService\.DenyAsync\(string\) Method {#Abblix.Oidc.Server.Features.DeviceAuthorization.UserCodeVerificationService.DenyAsync(string)}

Denies the device authorization request\.

```csharp
public System.Threading.Tasks.Task<bool> DenyAsync(string userCode);
```
#### Parameters

###### `userCode` [System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String') {#Abblix.Oidc.Server.Features.DeviceAuthorization.UserCodeVerificationService.DenyAsync(string).userCode}

The user\-entered verification code\.

Implements [DenyAsync\(string\)](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Features.DeviceAuthorization.Interfaces.IUserCodeVerificationService#Abblix.Oidc.Server.Features.DeviceAuthorization.Interfaces.IUserCodeVerificationService.DenyAsync(string) 'Abblix\.Oidc\.Server\.Features\.DeviceAuthorization\.Interfaces\.IUserCodeVerificationService\.DenyAsync\(string\)')

#### Returns
[System\.Threading\.Tasks\.Task&lt;](https://learn.microsoft.com/en-us/dotnet/api/system.threading.tasks.task-1 'System\.Threading\.Tasks\.Task\`1')[System\.Boolean](https://learn.microsoft.com/en-us/dotnet/api/system.boolean 'System\.Boolean')[&gt;](https://learn.microsoft.com/en-us/dotnet/api/system.threading.tasks.task-1 'System\.Threading\.Tasks\.Task\`1')  
A task that returns true if the denial was successful; false if the code is invalid or expired\.

## UserCodeVerificationService\.VerifyAsync\(string\) Method {#Abblix.Oidc.Server.Features.DeviceAuthorization.UserCodeVerificationService.VerifyAsync(string)}

Verifies a user code and returns the associated device authorization request details\.

```csharp
public System.Threading.Tasks.Task<Abblix.Oidc.Server.Features.DeviceAuthorization.UserCodeVerificationResult> VerifyAsync(string userCode);
```
#### Parameters

###### `userCode` [System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String') {#Abblix.Oidc.Server.Features.DeviceAuthorization.UserCodeVerificationService.VerifyAsync(string).userCode}

The user\-entered verification code\.

Implements [VerifyAsync\(string\)](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Features.DeviceAuthorization.Interfaces.IUserCodeVerificationService#Abblix.Oidc.Server.Features.DeviceAuthorization.Interfaces.IUserCodeVerificationService.VerifyAsync(string) 'Abblix\.Oidc\.Server\.Features\.DeviceAuthorization\.Interfaces\.IUserCodeVerificationService\.VerifyAsync\(string\)')

#### Returns
[System\.Threading\.Tasks\.Task&lt;](https://learn.microsoft.com/en-us/dotnet/api/system.threading.tasks.task-1 'System\.Threading\.Tasks\.Task\`1')[UserCodeVerificationResult](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Features.DeviceAuthorization.UserCodeVerificationResult 'Abblix\.Oidc\.Server\.Features\.DeviceAuthorization\.UserCodeVerificationResult')[&gt;](https://learn.microsoft.com/en-us/dotnet/api/system.threading.tasks.task-1 'System\.Threading\.Tasks\.Task\`1')  
A task that returns the verification result containing request details if valid,
or an appropriate error if the code is invalid, expired, or already used\.
