# Class JsonWebSignature (1.73.0)

<button class="button button-with-icon cloud-select-dropdown__button " aria-haspopup="true">Version latest</button>

- [1.73.0 (latest)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Auth.JsonWebSignature)
- [1.69.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/1.69.0/Google.Apis.Auth.JsonWebSignature)
- [1.68.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/1.68.0/Google.Apis.Auth.JsonWebSignature)
- [1.60.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/1.60.0/Google.Apis.Auth.JsonWebSignature)
- [1.59.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/1.59.0/Google.Apis.Auth.JsonWebSignature)
- [1.55.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/1.55.0/Google.Apis.Auth.JsonWebSignature)
- [1.50.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/1.50.0/Google.Apis.Auth.JsonWebSignature)

    public class JsonWebSignature

JSON Web Signature (JWS) implementation as specified in
<http://tools.ietf.org/html/draft-ietf-jose-json-web-signature-11>.

## Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) \> JsonWebSignature

## Inherited Members

[object.Equals(object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)) [object.Equals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)) [object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) [object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) [object.MemberwiseClone()](https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone) [object.ReferenceEquals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.referenceequals) [object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)

## Namespace

[Google.Apis.Auth](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Auth)

## Assembly

Google.Apis.Auth.dll

## Methods

### VerifySignedTokenAsync(string, SignedTokenVerificationOptions, CancellationToken)

    public static Task<JsonWebSignature.Payload> VerifySignedTokenAsync(string signedJwt, SignedTokenVerificationOptions options = null, CancellationToken cancellationToken = default)

Verifies that the given token is a valid, not expired, signed token.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `signedJwt` | `https://learn.microsoft.com/dotnet/api/system.string` The token to verify. |
| `options` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Auth.SignedTokenVerificationOptions` The options to use for verification. May be null in which case default options will be used. |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` The cancellation token for the operation. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Auth.JsonWebSignaturehttps://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Auth.JsonWebSignature.Payload` | The payload contained by the token. |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Auth.InvalidJwtException` | If the token is invalid or expired. |

### VerifySignedTokenAsync\<TPayload\>(string, SignedTokenVerificationOptions, CancellationToken)

    public static Task<TPayload> VerifySignedTokenAsync<TPayload>(string signedJwt, SignedTokenVerificationOptions options = null, CancellationToken cancellationToken = default) where TPayload : JsonWebSignature.Payload

Verifies that the given token is a valid, not expired, signed token.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `signedJwt` | `https://learn.microsoft.com/dotnet/api/system.string` The token to verify. |
| `options` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Auth.SignedTokenVerificationOptions` The options to use for verification. May be null in which case default options will be used. |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` The cancellation token for the operation. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1` | The payload contained by the token. |

| **Type Parameter** ||
|---|---|
| **Name** | **Description** |
| `TPayload` | The type of the payload to return, so user code can validate additional claims. Should extend [JsonWebSignature.Payload](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Auth.JsonWebSignature.Payload). Payload information will be deserialized using [Instance](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Json.NewtonsoftJsonSerializer#Google_Apis_Json_NewtonsoftJsonSerializer_Instance). |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Auth.InvalidJwtException` | If the token is invalid or expired. |

## Extension Method

[Utilities.ThrowIfNull\<T\>(T, string)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Util.Utilities#Google_Apis_Util_Utilities_ThrowIfNull__1___0_System_String_)