> ## Documentation Index
> Fetch the complete documentation index at: https://auth0-cq3uo.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# JSON Web Token

This list of <Tooltip tip="JSON Web Token (JWT): Standard ID Token format (and often Access Token format) used to represent claims securely between two parties." cta="View Glossary" href="/docs/glossary?term=JSON+Web+Token">JSON Web Token</Tooltip> actions allows you to generate, verify, and decode JWTs in your flows.

## Configure your Vault connection

To configure a Vault connection for your JSON Web Token actions using **HS256 algorithm**, you will need a **Secret:**

<Frame>![Dashboard > Actions > Forms > Flows > actions > JSON web token](https://images.ctfassets.net/cdy7uua7fh8z/1WnUlIe2QZf39G45PHcQGp/40d768da226a0cefa09c62c5cab78577/jwt-vault-connection.png)</Frame>

## Sign JSON web token

Generates a JSON web token.

<Frame>![](https://images.ctfassets.net/cdy7uua7fh8z/3XQqUMKrmrc8fUkCsDhI2T/43f7f8d38673d8fa4f9dba7242e044d9/sign-json-web-token.png)</Frame>

### Input settings

<table class="table">
  <thead>
    <tr>
      <th><b>Parameter</b></th>
      <th><b>Description</b></th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>Payload</td>

      <td>
        Data to encode. We recommend to format it according to OpenID standards.
      </td>
    </tr>

    <tr>
      <td>Subject</td>

      <td>
        Identifies the subject of the JWT.
      </td>
    </tr>

    <tr>
      <td>Issuer</td>

      <td>
        Identifies principal that issued the JWT.
      </td>
    </tr>

    <tr>
      <td>Audience</td>

      <td>
        Identifies the recipients that the JWT is intended. For example:  admin.your\_domain.com
      </td>
    </tr>

    <tr>
      <td>Expires in</td>

      <td>
        Identifies the expiration time on and after which the JWT must not be accepted for processing.
      </td>
    </tr>
  </tbody>
</table>

### Output object

<table class="table">
  <thead>
    <tr>
      <th><b>Property</b></th>
      <th><b>Type</b></th>
      <th><b>Description</b></th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td><code>token</code></td>
      <td>String</td>
      <td>A JSON web token string.</td>
    </tr>
  </tbody>
</table>

### Output object example

```json lines theme={null}
{
  "token": "eyJhbGciOiJIUzI1N..."
}
```

## Decode JSON web token

Decodes a provided JSON web token.

<Frame>![](https://images.ctfassets.net/cdy7uua7fh8z/7I25WVtppllW6qhC5sALvH/70143bbe0d96920e1d9dfabbb1d6aeff/decode-json-web-token.png)</Frame>

### Input settings

<table class="table">
  <thead>
    <tr>
      <th><b>Parameter</b></th>
      <th><b>Description</b></th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>Token (required)</td>

      <td>
        JSON web token string that will be decoded.
      </td>
    </tr>
  </tbody>
</table>

### Output object

<table class="table">
  <thead>
    <tr>
      <th><b>Property</b></th>
      <th><b>Type</b></th>
      <th><b>Description</b></th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td><code>payload</code></td>
      <td>object</td>
      <td>The decoded and valid JSON web token content</td>
    </tr>
  </tbody>
</table>

### Output object example

```json lines theme={null}
{
  "header": {
    "alg": "HS256",
    "typ": "JWT"
  },
  "payload": {
    "sub": "1234567890",
    "name": "John Doe",
    "iat": 1516239022
  },
  "signature": "SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"
}
```

## Verify JSON web token

Verifies the JSON web token data, to determine if it remains intact or has been modified, in order to guarantee its authenticity.

<Frame>![](https://images.ctfassets.net/cdy7uua7fh8z/15MDJcfZqtC46h6mRPOGcz/55e0785db066a54f836d30199fa5f295/verify-json-web-token.png)</Frame>

### Input settings

<table class="table">
  <thead>
    <tr>
      <th><b>Parameter</b></th>
      <th><b>Description</b></th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>Token (required)</td>

      <td>
        JSON web token string that will be verified.
      </td>
    </tr>

    <tr>
      <td>Issuer</td>

      <td>
        The issuer of the JWT that will be verified.
      </td>
    </tr>

    <tr>
      <td>Audience</td>

      <td>
        The recipient audience of the JWT is intended that will be verified.
      </td>
    </tr>
  </tbody>
</table>

### Output object

<table class="table">
  <thead>
    <tr>
      <th><b>Property</b></th>
      <th><b>Type</b></th>
      <th><b>Description</b></th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td><code>valid</code></td>
      <td>Boolean</td>
      <td>Returns <code>true</code> or <code>false</code> depending on whether or not the JWT has a valid signature.</td>
    </tr>

    <tr>
      <td><code>cause</code></td>
      <td>String</td>
      <td>If the <code>valid</code> property is <code>false</code> a message is displayed.</td>
    </tr>

    <tr>
      <td><code>payload</code></td>
      <td>Object</td>
      <td>The decoded and valid JSON web token content.</td>
    </tr>
  </tbody>
</table>

### Output object example

```json lines theme={null}
{
  "valid": true,
  "header": {
    "alg": "HS256",
    "typ": "JWT"
  },
  "payload": {
    "sub": "1234567890",
    "name": "Jane Doe",
    "iat": 1516239022
  },
  "signature": "SflKxwRJSMe..."
}
```

```json lines theme={null}
{
  "valid": false,
  "cause": "INVALID_SIGNATURE"
}
```
