---
title: "Client authentication with JSON Web Tokens"
canonical_url: "https://www.nutrient.io/guides/document-engine/instant-synchronization/authentication/"
md_url: "https://www.nutrient.io/guides/document-engine/instant-synchronization/authentication.md"
last_updated: "2026-05-14T21:57:26.840Z"
description: "Learn how to authenticate clients using JSON Web Tokens in Nutrient Document Engine for web and mobile. Discover guidelines and troubleshooting tips."
---

# Authenticate clients with JWT in Document Engine

When using Nutrient’s SDK clients for web and mobile platforms, your client needs to authenticate itself with your running Document Engine instance. To do this, you need to [generate a JSON Web Token (JWT)](https://www.nutrient.io/guides/document-engine/viewer/client-authentication/generate-a-jwt.md). In most cases, your own backend application will generate a JWT that’s sent to your users.

Your users then use the JWT your app supplied to authenticate themselves with Document Engine, which will then return only the data the user is allowed to see. In general, a JWT will give the user access to a specific document and [Instant layer](https://www.nutrient.io/api/reference/document-engine/upstream/#tag/Layers) combination. If you’re using [Collaboration Permissions](https://www.nutrient.io/guides/document-engine/instant-synchronization/permissions/overview.md), the JWT can also control which actions the user can take and which resources the user can see.

If you’re having trouble generating valid JWTs, we have a guide that shows you how to [validate JWTs](https://www.nutrient.io/guides/document-engine/viewer/client-authentication/validate-a-jwt.md) using the [Document Engine dashboard](https://www.nutrient.io/guides/document-engine/management/dashboard.md).

For Web SDK clients using short-lived JWTs, use runtime token renewal with `onAuthFailed` and `setSession` to keep long-running sessions active without reloading the viewer. Refer to the guide on [web client authentication and session renewal](https://www.nutrient.io/guides/web/viewer/client-authentication.md).
---

## Related pages

- [Instant sync and real-time collaboration](/guides/document-engine/instant-synchronization.md)
- [Adding comments to PDFs on web and mobile](/guides/document-engine/instant-synchronization/comments.md)
- [Document layers for all workflows](/guides/document-engine/instant-synchronization/instant-layers.md)
- [Integrate real-time collaboration with instant sync](/guides/document-engine/instant-synchronization/get-started.md)

