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

## IDeviceAuthorizationStorage Interface

Defines the contract for a storage system responsible for persisting and retrieving
device authorization requests as defined in RFC 8628\.

```csharp
public interface IDeviceAuthorizationStorage
```

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

## IDeviceAuthorizationStorage\.RemoveAsync\(string\) Method {#Abblix.Oidc.Server.Features.DeviceAuthorization.Interfaces.IDeviceAuthorizationStorage.RemoveAsync(string)}

Removes a device authorization request from storage using its device code\.

```csharp
System.Threading.Tasks.Task RemoveAsync(string deviceCode);
```
#### Parameters

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

The device code identifier\.

#### Returns
[System\.Threading\.Tasks\.Task](https://learn.microsoft.com/en-us/dotnet/api/system.threading.tasks.task 'System\.Threading\.Tasks\.Task')  
A task that completes when the request is removed from storage\.

## IDeviceAuthorizationStorage\.StoreAsync\(string, DeviceAuthorizationRequest, TimeSpan\) Method {#Abblix.Oidc.Server.Features.DeviceAuthorization.Interfaces.IDeviceAuthorizationStorage.StoreAsync(string,Abblix.Oidc.Server.Features.DeviceAuthorization.DeviceAuthorizationRequest,System.TimeSpan)}

Stores a device authorization request with the specified device code\.

```csharp
System.Threading.Tasks.Task StoreAsync(string deviceCode, Abblix.Oidc.Server.Features.DeviceAuthorization.DeviceAuthorizationRequest request, System.TimeSpan expiresIn);
```
#### Parameters

###### `deviceCode` [System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String') {#Abblix.Oidc.Server.Features.DeviceAuthorization.Interfaces.IDeviceAuthorizationStorage.StoreAsync(string,Abblix.Oidc.Server.Features.DeviceAuthorization.DeviceAuthorizationRequest,System.TimeSpan).deviceCode}

The unique device code identifier\.

###### `request` [DeviceAuthorizationRequest](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Features.DeviceAuthorization.DeviceAuthorizationRequest 'Abblix\.Oidc\.Server\.Features\.DeviceAuthorization\.DeviceAuthorizationRequest') {#Abblix.Oidc.Server.Features.DeviceAuthorization.Interfaces.IDeviceAuthorizationStorage.StoreAsync(string,Abblix.Oidc.Server.Features.DeviceAuthorization.DeviceAuthorizationRequest,System.TimeSpan).request}

The device authorization request to store\.

###### `expiresIn` [System\.TimeSpan](https://learn.microsoft.com/en-us/dotnet/api/system.timespan 'System\.TimeSpan') {#Abblix.Oidc.Server.Features.DeviceAuthorization.Interfaces.IDeviceAuthorizationStorage.StoreAsync(string,Abblix.Oidc.Server.Features.DeviceAuthorization.DeviceAuthorizationRequest,System.TimeSpan).expiresIn}

The duration after which the stored request will expire\.

#### Returns
[System\.Threading\.Tasks\.Task](https://learn.microsoft.com/en-us/dotnet/api/system.threading.tasks.task 'System\.Threading\.Tasks\.Task')  
A task that completes when the request is stored\.

## IDeviceAuthorizationStorage\.TryGetByDeviceCodeAsync\(string\) Method {#Abblix.Oidc.Server.Features.DeviceAuthorization.Interfaces.IDeviceAuthorizationStorage.TryGetByDeviceCodeAsync(string)}

Tries to retrieve a device authorization request by its device code\.
This is used by the client when polling the token endpoint\.

```csharp
System.Threading.Tasks.Task<Abblix.Oidc.Server.Features.DeviceAuthorization.DeviceAuthorizationRequest?> TryGetByDeviceCodeAsync(string deviceCode);
```
#### Parameters

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

The device code identifier\.

#### Returns
[System\.Threading\.Tasks\.Task&lt;](https://learn.microsoft.com/en-us/dotnet/api/system.threading.tasks.task-1 'System\.Threading\.Tasks\.Task\`1')[DeviceAuthorizationRequest](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Features.DeviceAuthorization.DeviceAuthorizationRequest 'Abblix\.Oidc\.Server\.Features\.DeviceAuthorization\.DeviceAuthorizationRequest')[&gt;](https://learn.microsoft.com/en-us/dotnet/api/system.threading.tasks.task-1 'System\.Threading\.Tasks\.Task\`1')  
A task that returns the device authorization request if found; otherwise, null\.

## IDeviceAuthorizationStorage\.TryGetByUserCodeAsync\(string\) Method {#Abblix.Oidc.Server.Features.DeviceAuthorization.Interfaces.IDeviceAuthorizationStorage.TryGetByUserCodeAsync(string)}

Tries to retrieve a device authorization request by its user code\.
This is used during user verification to look up the pending request\.

```csharp
System.Threading.Tasks.Task<System.Nullable<(string DeviceCode,Abblix.Oidc.Server.Features.DeviceAuthorization.DeviceAuthorizationRequest Request)>> TryGetByUserCodeAsync(string userCode);
```
#### Parameters

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

The user\-friendly verification code\.

#### 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\.Nullable&lt;](https://learn.microsoft.com/en-us/dotnet/api/system.nullable-1 'System\.Nullable\`1')[&lt;](https://learn.microsoft.com/en-us/dotnet/api/system.valuetuple 'System\.ValueTuple')[System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String')[,](https://learn.microsoft.com/en-us/dotnet/api/system.valuetuple 'System\.ValueTuple')[DeviceAuthorizationRequest](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Features.DeviceAuthorization.DeviceAuthorizationRequest 'Abblix\.Oidc\.Server\.Features\.DeviceAuthorization\.DeviceAuthorizationRequest')[&gt;](https://learn.microsoft.com/en-us/dotnet/api/system.valuetuple 'System\.ValueTuple')[&gt;](https://learn.microsoft.com/en-us/dotnet/api/system.nullable-1 'System\.Nullable\`1')[&gt;](https://learn.microsoft.com/en-us/dotnet/api/system.threading.tasks.task-1 'System\.Threading\.Tasks\.Task\`1')  
A task that returns the device code and request if found; otherwise, null\.

## IDeviceAuthorizationStorage\.TryRemoveAsync\(string, string\) Method {#Abblix.Oidc.Server.Features.DeviceAuthorization.Interfaces.IDeviceAuthorizationStorage.TryRemoveAsync(string,string)}

Atomically attempts to remove a device authorization request by its device code\.
This operation is thread\-safe and returns whether the removal was successful\.

```csharp
System.Threading.Tasks.Task<bool> TryRemoveAsync(string deviceCode, string userCode);
```
#### Parameters

###### `deviceCode` [System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String') {#Abblix.Oidc.Server.Features.DeviceAuthorization.Interfaces.IDeviceAuthorizationStorage.TryRemoveAsync(string,string).deviceCode}

The device code identifier\.

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

The user code for cleaning up the secondary index mapping\.

#### 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 request was found and removed; false otherwise\.

## IDeviceAuthorizationStorage\.UpdateAsync\(string, DeviceAuthorizationRequest, TimeSpan\) Method {#Abblix.Oidc.Server.Features.DeviceAuthorization.Interfaces.IDeviceAuthorizationStorage.UpdateAsync(string,Abblix.Oidc.Server.Features.DeviceAuthorization.DeviceAuthorizationRequest,System.TimeSpan)}

Updates an existing device authorization request in storage, refreshing its cache entry with the
caller\-supplied remaining lifetime\.

```csharp
System.Threading.Tasks.Task UpdateAsync(string deviceCode, Abblix.Oidc.Server.Features.DeviceAuthorization.DeviceAuthorizationRequest request, System.TimeSpan expiresIn);
```
#### Parameters

###### `deviceCode` [System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String') {#Abblix.Oidc.Server.Features.DeviceAuthorization.Interfaces.IDeviceAuthorizationStorage.UpdateAsync(string,Abblix.Oidc.Server.Features.DeviceAuthorization.DeviceAuthorizationRequest,System.TimeSpan).deviceCode}

The device code identifier\.

###### `request` [DeviceAuthorizationRequest](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Features.DeviceAuthorization.DeviceAuthorizationRequest 'Abblix\.Oidc\.Server\.Features\.DeviceAuthorization\.DeviceAuthorizationRequest') {#Abblix.Oidc.Server.Features.DeviceAuthorization.Interfaces.IDeviceAuthorizationStorage.UpdateAsync(string,Abblix.Oidc.Server.Features.DeviceAuthorization.DeviceAuthorizationRequest,System.TimeSpan).request}

The updated device authorization request\.

###### `expiresIn` [System\.TimeSpan](https://learn.microsoft.com/en-us/dotnet/api/system.timespan 'System\.TimeSpan') {#Abblix.Oidc.Server.Features.DeviceAuthorization.Interfaces.IDeviceAuthorizationStorage.UpdateAsync(string,Abblix.Oidc.Server.Features.DeviceAuthorization.DeviceAuthorizationRequest,System.TimeSpan).expiresIn}

The remaining lifetime to apply as the cache TTL\. The caller derives it from
            the request's fixed expiry \(RFC 8628 §3\.2\) so that repeated polling cannot extend the code\.

#### Returns
[System\.Threading\.Tasks\.Task](https://learn.microsoft.com/en-us/dotnet/api/system.threading.tasks.task 'System\.Threading\.Tasks\.Task')  
A task that completes when the request is updated\.
