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

## DeviceAuthorizationRequest Class

Represents a stored device authorization request as defined in RFC 8628\.
This record is used to persist the state of a device authorization flow
between the initial request and when the user completes authentication\.

```csharp
public record DeviceAuthorizationRequest : System.IEquatable<Abblix.Oidc.Server.Features.DeviceAuthorization.DeviceAuthorizationRequest>
```

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

Implements [System\.IEquatable&lt;](https://learn.microsoft.com/en-us/dotnet/api/system.iequatable-1 'System\.IEquatable\`1')[DeviceAuthorizationRequest](https://www.abblix.com/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.iequatable-1 'System\.IEquatable\`1')
### Constructors

## DeviceAuthorizationRequest\(string, string\[\], Uri\[\], string\) Constructor {#Abblix.Oidc.Server.Features.DeviceAuthorization.DeviceAuthorizationRequest.DeviceAuthorizationRequest(string,string[],System.Uri[],string)}

Represents a stored device authorization request as defined in RFC 8628\.
This record is used to persist the state of a device authorization flow
between the initial request and when the user completes authentication\.

```csharp
public DeviceAuthorizationRequest(string ClientId, string[] Scope, System.Uri[]? Resources, string UserCode);
```
#### Parameters

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

The client identifier that initiated the device authorization request\.

###### `Scope` [System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String')[\[\]](https://learn.microsoft.com/en-us/dotnet/api/system.array 'System\.Array') {#Abblix.Oidc.Server.Features.DeviceAuthorization.DeviceAuthorizationRequest.DeviceAuthorizationRequest(string,string[],System.Uri[],string).Scope}

The requested scopes for the authorization\.

###### `Resources` [System\.Uri](https://learn.microsoft.com/en-us/dotnet/api/system.uri 'System\.Uri')[\[\]](https://learn.microsoft.com/en-us/dotnet/api/system.array 'System\.Array') {#Abblix.Oidc.Server.Features.DeviceAuthorization.DeviceAuthorizationRequest.DeviceAuthorizationRequest(string,string[],System.Uri[],string).Resources}

The requested resources \(RFC 8707\) for the authorization\.

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

The user\-friendly code displayed to the user for verification\.
### Properties

## DeviceAuthorizationRequest\.AuthorizationDetails Property {#Abblix.Oidc.Server.Features.DeviceAuthorization.DeviceAuthorizationRequest.AuthorizationDetails}

RFC 9396 Section 3 Rich Authorization Requests array carried from the original
`/device_authorization` request\. The host's user\-verification step reads this
\(via [ValidUserCode](https://www.abblix.com/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Features.DeviceAuthorization.ValidUserCode 'Abblix\.Oidc\.Server\.Features\.DeviceAuthorization\.ValidUserCode')\) to render structured consent, then threads it into
the [AuthorizedGrant](https://www.abblix.com/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Features.DeviceAuthorization.DeviceAuthorizationRequest#Abblix.Oidc.Server.Features.DeviceAuthorization.DeviceAuthorizationRequest.AuthorizedGrant 'Abblix\.Oidc\.Server\.Features\.DeviceAuthorization\.DeviceAuthorizationRequest\.AuthorizedGrant')'s `AuthorizationContext` when approving;
the eventual access token issued via the device\-code grant emits the claim byte\-exact\.

```csharp
public System.Text.Json.Nodes.JsonArray? AuthorizationDetails { get; set; }
```

#### Property Value
[System\.Text\.Json\.Nodes\.JsonArray](https://learn.microsoft.com/en-us/dotnet/api/system.text.json.nodes.jsonarray 'System\.Text\.Json\.Nodes\.JsonArray')

## DeviceAuthorizationRequest\.AuthorizedGrant Property {#Abblix.Oidc.Server.Features.DeviceAuthorization.DeviceAuthorizationRequest.AuthorizedGrant}

The authorized grant containing the user's authentication session and authorization context\.
This is set when the user successfully authorizes the device\.

```csharp
public Abblix.Oidc.Server.Endpoints.Token.Interfaces.AuthorizedGrant? AuthorizedGrant { get; set; }
```

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

## DeviceAuthorizationRequest\.ClientId Property {#Abblix.Oidc.Server.Features.DeviceAuthorization.DeviceAuthorizationRequest.ClientId}

The client identifier that initiated the device authorization request\.

```csharp
public string ClientId { get; init; }
```

#### Property Value
[System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String')

## DeviceAuthorizationRequest\.ExpiresAt Property {#Abblix.Oidc.Server.Features.DeviceAuthorization.DeviceAuthorizationRequest.ExpiresAt}

The absolute time when this device authorization request expires \(RFC 8628 Section 3\.2 fixed lifetime\)\.
Seeded by the storage on `StoreAsync` and used to cap the refreshed cache TTL at the remaining
lifetime, so regular polling cannot extend the code\.

```csharp
public System.DateTimeOffset ExpiresAt { get; set; }
```

#### Property Value
[System\.DateTimeOffset](https://learn.microsoft.com/en-us/dotnet/api/system.datetimeoffset 'System\.DateTimeOffset')

## DeviceAuthorizationRequest\.NextPollAt Property {#Abblix.Oidc.Server.Features.DeviceAuthorization.DeviceAuthorizationRequest.NextPollAt}

Specifies the next time the client should poll for updates regarding the authorization request\.
This helps manage the timing of polling requests and enforces rate limiting\.

```csharp
public System.Nullable<System.DateTimeOffset> NextPollAt { get; set; }
```

#### Property Value
[System\.Nullable&lt;](https://learn.microsoft.com/en-us/dotnet/api/system.nullable-1 'System\.Nullable\`1')[System\.DateTimeOffset](https://learn.microsoft.com/en-us/dotnet/api/system.datetimeoffset 'System\.DateTimeOffset')[&gt;](https://learn.microsoft.com/en-us/dotnet/api/system.nullable-1 'System\.Nullable\`1')

## DeviceAuthorizationRequest\.Resources Property {#Abblix.Oidc.Server.Features.DeviceAuthorization.DeviceAuthorizationRequest.Resources}

The requested resources \(RFC 8707\) for the authorization\.

```csharp
public System.Uri[]? Resources { get; init; }
```

#### Property Value
[System\.Uri](https://learn.microsoft.com/en-us/dotnet/api/system.uri 'System\.Uri')[\[\]](https://learn.microsoft.com/en-us/dotnet/api/system.array 'System\.Array')

## DeviceAuthorizationRequest\.Scope Property {#Abblix.Oidc.Server.Features.DeviceAuthorization.DeviceAuthorizationRequest.Scope}

The requested scopes for the authorization\.

```csharp
public string[] Scope { get; init; }
```

#### Property Value
[System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String')[\[\]](https://learn.microsoft.com/en-us/dotnet/api/system.array 'System\.Array')

## DeviceAuthorizationRequest\.Status Property {#Abblix.Oidc.Server.Features.DeviceAuthorization.DeviceAuthorizationRequest.Status}

Indicates the current status of the device authorization request\.
Defaults to Pending, reflecting that the user has not yet completed authentication\.

```csharp
public Abblix.Oidc.Server.Features.DeviceAuthorization.DeviceAuthorizationStatus Status { get; set; }
```

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

## DeviceAuthorizationRequest\.UserCode Property {#Abblix.Oidc.Server.Features.DeviceAuthorization.DeviceAuthorizationRequest.UserCode}

The user\-friendly code displayed to the user for verification\.

```csharp
public string UserCode { get; init; }
```

#### Property Value
[System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String')
### Methods

## DeviceAuthorizationRequest\.HasLifetimeLeft\(DateTimeOffset, TimeSpan\) Method {#Abblix.Oidc.Server.Features.DeviceAuthorization.DeviceAuthorizationRequest.HasLifetimeLeft(System.DateTimeOffset,System.TimeSpan)}

Whether the fixed lifetime still has time left at [now](https://www.abblix.com/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Features.DeviceAuthorization.DeviceAuthorizationRequest#Abblix.Oidc.Server.Features.DeviceAuthorization.DeviceAuthorizationRequest.HasLifetimeLeft(System.DateTimeOffset,System.TimeSpan).now 'Abblix\.Oidc\.Server\.Features\.DeviceAuthorization\.DeviceAuthorizationRequest\.HasLifetimeLeft\(System\.DateTimeOffset, System\.TimeSpan\)\.now'), handing back how much\.

```csharp
public bool HasLifetimeLeft(System.DateTimeOffset now, out System.TimeSpan remaining);
```
#### Parameters

###### `now` [System\.DateTimeOffset](https://learn.microsoft.com/en-us/dotnet/api/system.datetimeoffset 'System\.DateTimeOffset') {#Abblix.Oidc.Server.Features.DeviceAuthorization.DeviceAuthorizationRequest.HasLifetimeLeft(System.DateTimeOffset,System.TimeSpan).now}

The instant to judge against, from the caller's own time provider\.

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

How much lifetime is left; zero or negative when there is none\.

#### Returns
[System\.Boolean](https://learn.microsoft.com/en-us/dotnet/api/system.boolean 'System\.Boolean')  
`true` while the request can still be acted on\.

### Remarks
The comparison sits here because it was being written out at each caller, and one of them
forgot it: user code verification, the step the end user reaches first, decided on
[Status](https://www.abblix.com/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Features.DeviceAuthorization.DeviceAuthorizationRequest#Abblix.Oidc.Server.Features.DeviceAuthorization.DeviceAuthorizationRequest.Status 'Abblix\.Oidc\.Server\.Features\.DeviceAuthorization\.DeviceAuthorizationRequest\.Status') alone and answered a full result for a record the approval would then refuse\.

It is now the only verdict on that boundary:
[DeviceCodeGrantHandler](https://www.abblix.com/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Endpoints.Token.Grants.DeviceCodeGrantHandler 'Abblix\.Oidc\.Server\.Endpoints\.Token\.Grants\.DeviceCodeGrantHandler') asks this rather than comparing for
itself, so the token endpoint and the three paths above cannot disagree about a code polled at
exactly its expiry. What holds it is that relaxing this one predicate turns rows red on both
sides of that seam - the two approval rows and the token endpoint's - rather than two
comparisons happening to stay in step.

It hands back the remaining time because the callers that act on the record need it: a decision
is written with that as the cache TTL, so the code cannot be extended by being decided on.
