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

## IAccessTokenService Interface

Issues OAuth 2\.0 access tokens as signed JWTs \(RFC 9068 access\-token format\) and reverses
the mapping by reconstructing the originating [AuthSession](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Features.UserAuthentication.AuthSession 'Abblix\.Oidc\.Server\.Features\.UserAuthentication\.AuthSession') and
[AuthorizationContext](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Common.AuthorizationContext 'Abblix\.Oidc\.Server\.Common\.AuthorizationContext') from the token's claims\.

```csharp
public interface IAccessTokenService
```
### Methods

## IAccessTokenService\.AuthenticateByAccessTokenAsync\(JsonWebToken\) Method {#Abblix.Oidc.Server.Features.Tokens.IAccessTokenService.AuthenticateByAccessTokenAsync(Abblix.Jwt.JsonWebToken)}

Asynchronously authenticates a user based on a provided access token\.

```csharp
System.Threading.Tasks.Task<(Abblix.Oidc.Server.Features.UserAuthentication.AuthSession,Abblix.Oidc.Server.Common.AuthorizationContext)> AuthenticateByAccessTokenAsync(Abblix.Jwt.JsonWebToken accessToken);
```
#### Parameters

###### `accessToken` [JsonWebToken](https://www.abblix.com/en/docs/api/abblix-jwt/Abblix.Jwt.JsonWebToken 'Abblix\.Jwt\.JsonWebToken') {#Abblix.Oidc.Server.Features.Tokens.IAccessTokenService.AuthenticateByAccessTokenAsync(Abblix.Jwt.JsonWebToken).accessToken}

The access token to authenticate\.

#### Returns
[System\.Threading\.Tasks\.Task&lt;](https://learn.microsoft.com/en-us/dotnet/api/system.threading.tasks.task-1 'System\.Threading\.Tasks\.Task\`1')[&lt;](https://learn.microsoft.com/en-us/dotnet/api/system.valuetuple 'System\.ValueTuple')[AuthSession](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Features.UserAuthentication.AuthSession 'Abblix\.Oidc\.Server\.Features\.UserAuthentication\.AuthSession')[,](https://learn.microsoft.com/en-us/dotnet/api/system.valuetuple 'System\.ValueTuple')[AuthorizationContext](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Common.AuthorizationContext 'Abblix\.Oidc\.Server\.Common\.AuthorizationContext')[&gt;](https://learn.microsoft.com/en-us/dotnet/api/system.valuetuple 'System\.ValueTuple')[&gt;](https://learn.microsoft.com/en-us/dotnet/api/system.threading.tasks.task-1 'System\.Threading\.Tasks\.Task\`1')  
A task that represents the asynchronous authentication operation\. The task result contains
            the [AuthSession](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Features.UserAuthentication.AuthSession 'Abblix\.Oidc\.Server\.Features\.UserAuthentication\.AuthSession') and [AuthorizationContext](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Common.AuthorizationContext 'Abblix\.Oidc\.Server\.Common\.AuthorizationContext') associated with the authenticated user\.

## IAccessTokenService\.CreateAccessTokenAsync\(AuthSession, AuthorizationContext, ClientInfo\) Method {#Abblix.Oidc.Server.Features.Tokens.IAccessTokenService.CreateAccessTokenAsync(Abblix.Oidc.Server.Features.UserAuthentication.AuthSession,Abblix.Oidc.Server.Common.AuthorizationContext,Abblix.Oidc.Server.Features.ClientInformation.ClientInfo)}

Asynchronously creates a new access token based on the given authentication session, authorization context
and client information\.

```csharp
System.Threading.Tasks.Task<Abblix.Oidc.Server.Features.Tokens.EncodedJsonWebToken> CreateAccessTokenAsync(Abblix.Oidc.Server.Features.UserAuthentication.AuthSession authSession, Abblix.Oidc.Server.Common.AuthorizationContext authContext, Abblix.Oidc.Server.Features.ClientInformation.ClientInfo clientInfo);
```
#### Parameters

###### `authSession` [AuthSession](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Features.UserAuthentication.AuthSession 'Abblix\.Oidc\.Server\.Features\.UserAuthentication\.AuthSession') {#Abblix.Oidc.Server.Features.Tokens.IAccessTokenService.CreateAccessTokenAsync(Abblix.Oidc.Server.Features.UserAuthentication.AuthSession,Abblix.Oidc.Server.Common.AuthorizationContext,Abblix.Oidc.Server.Features.ClientInformation.ClientInfo).authSession}

The authentication session containing user and session details\.

###### `authContext` [AuthorizationContext](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Common.AuthorizationContext 'Abblix\.Oidc\.Server\.Common\.AuthorizationContext') {#Abblix.Oidc.Server.Features.Tokens.IAccessTokenService.CreateAccessTokenAsync(Abblix.Oidc.Server.Features.UserAuthentication.AuthSession,Abblix.Oidc.Server.Common.AuthorizationContext,Abblix.Oidc.Server.Features.ClientInformation.ClientInfo).authContext}

The authorization context containing details about the granted permissions and scopes\.

###### `clientInfo` [ClientInfo](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Features.ClientInformation.ClientInfo 'Abblix\.Oidc\.Server\.Features\.ClientInformation\.ClientInfo') {#Abblix.Oidc.Server.Features.Tokens.IAccessTokenService.CreateAccessTokenAsync(Abblix.Oidc.Server.Features.UserAuthentication.AuthSession,Abblix.Oidc.Server.Common.AuthorizationContext,Abblix.Oidc.Server.Features.ClientInformation.ClientInfo).clientInfo}

Information about the client for whom the token is being created\.

#### Returns
[System\.Threading\.Tasks\.Task&lt;](https://learn.microsoft.com/en-us/dotnet/api/system.threading.tasks.task-1 'System\.Threading\.Tasks\.Task\`1')[EncodedJsonWebToken](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Features.Tokens.EncodedJsonWebToken 'Abblix\.Oidc\.Server\.Features\.Tokens\.EncodedJsonWebToken')[&gt;](https://learn.microsoft.com/en-us/dotnet/api/system.threading.tasks.task-1 'System\.Threading\.Tasks\.Task\`1')  
A task that represents the asynchronous create operation\.
            The task result contains the newly created [JsonWebToken](https://www.abblix.com/en/docs/api/abblix-jwt/Abblix.Jwt.JsonWebToken 'Abblix\.Jwt\.JsonWebToken')\.
