# com.atproto.server.getServiceAuth

> Published by [atproto-lexicons.bsky.social](https://lexicon.garden/identity/did:plc:6msi3pj7krzih5qxqtryxlzw)

✓ This is the authoritative definition for this NSID.

## Links

- [View on Lexicon Garden](https://lexicon.garden/lexicon/did:plc:6msi3pj7krzih5qxqtryxlzw/com.atproto.server.getServiceAuth)
- [Documentation](https://lexicon.garden/lexicon/did:plc:6msi3pj7krzih5qxqtryxlzw/com.atproto.server.getServiceAuth/docs)
- [Examples](https://lexicon.garden/lexicon/did:plc:6msi3pj7krzih5qxqtryxlzw/com.atproto.server.getServiceAuth/examples)

## Definitions

### `com.atproto.server.getServiceAuth`

**Type**: `query`

Get a signed token on behalf of the requesting DID for the requested service.

#### Parameters

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `aud` | `string` | Yes | The DID or `did#serviceId` reference of the service that the token will be used to authenticate with. |
| `exp` | `integer` | No | The time in Unix Epoch seconds that the JWT expires. Defaults to 60 seconds in the future. The service may enforce certain time bounds on tokens depending on the requested scope. |
| `lxm` | `string` (nsid) | No | Lexicon (XRPC) method to bind the requested token to |

#### Output

**Encoding**: `application/json`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `token` | `string` | Yes |  |

#### Errors

- **BadExpiration**: Indicates that the requested expiration date is not a valid. May be in the past or may be reliant on the requested scopes.

## Raw Schema

```json
{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "main": {
      "description": "Get a signed token on behalf of the requesting DID for the requested service.",
      "errors": [
        {
          "description": "Indicates that the requested expiration date is not a valid. May be in the past or may be reliant on the requested scopes.",
          "name": "BadExpiration"
        }
      ],
      "output": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "token": {
              "type": "string"
            }
          },
          "required": [
            "token"
          ],
          "type": "object"
        }
      },
      "parameters": {
        "properties": {
          "aud": {
            "description": "The DID or `did#serviceId` reference of the service that the token will be used to authenticate with.",
            "maxLength": 2048,
            "type": "string"
          },
          "exp": {
            "description": "The time in Unix Epoch seconds that the JWT expires. Defaults to 60 seconds in the future. The service may enforce certain time bounds on tokens depending on the requested scope.",
            "type": "integer"
          },
          "lxm": {
            "description": "Lexicon (XRPC) method to bind the requested token to",
            "format": "nsid",
            "type": "string"
          }
        },
        "required": [
          "aud"
        ],
        "type": "params"
      },
      "type": "query"
    }
  },
  "id": "com.atproto.server.getServiceAuth",
  "lexicon": 1
}
```
