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

## IAuthServiceJwtFormatter Interface

Serializes a [JsonWebToken](https://www.abblix.com/en/docs/api/abblix-jwt/Abblix.Jwt.JsonWebToken 'Abblix\.Jwt\.JsonWebToken') minted by the authorization server itself \(access
tokens, refresh tokens, Registration Access Tokens\) into a compact JWS form \(RFC 7515\) using
the server's signing keys, optionally wrapping the result in a JWE \(RFC 7516\) when an
encryption key is available\.

```csharp
public interface IAuthServiceJwtFormatter
```

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

## IAuthServiceJwtFormatter\.FormatAsync\(JsonWebToken\) Method {#Abblix.Oidc.Server.Features.Tokens.Formatters.IAuthServiceJwtFormatter.FormatAsync(Abblix.Jwt.JsonWebToken)}

Formats and signs a JWT for use within the authentication service, applying cryptographic operations such as
signing and optionally encrypting the token based on the specified requirements\.

```csharp
System.Threading.Tasks.Task<string> FormatAsync(Abblix.Jwt.JsonWebToken token);
```
#### Parameters

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

The JSON Web Token \(JWT\) to be formatted and signed, potentially also encrypted\.

#### 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\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String')[&gt;](https://learn.microsoft.com/en-us/dotnet/api/system.threading.tasks.task-1 'System\.Threading\.Tasks\.Task\`1')  
A task representing the asynchronous operation, which results in the JWT formatted as a string\.
