Skip to main content

Introduction

When users sign in with Dynamic, the SDK receives a JSON Web Token (JWT). The SDK uses it to build the user object and Verified Credentials. For what JWTs are, how Dynamic uses them, and how to verify them on your backend, see Server-side auth and JWT. If you don’t need to access the JWT directly, you can use the user object instead—see the Users section.

Accessing JWTs

Fetch JWT from SDK

Access the JWT token through the dynamic client’s auth module:
React Native
import { dynamicClient } from '<path to client file>';

// Access the JWT token
const authToken = dynamicClient.auth.token;

if (authToken) {
  // do something with the token
  console.log('JWT token:', authToken);
}

Using JWTs

JWT Vs User Object

Normally, you do not need to use the JWT directly, as all of the information/claims are stored on the user object, which you can learn about in the Users section. If however you are doing server-side verification, you can use the JWT to verify the user’s identity. For an SDK-agnostic explanation of JWTs and how to verify them on your backend, see Server-side auth and JWT. For SDK-specific steps and code samples, see Server-side verification.

JWT Payload

For the full JWT payload and claims reference (standard and Dynamic-specific claims, example), see Understanding JWTs in the overview.

Using your own JWTs

To use your own JWTs to sign users into Dynamic, see Using your own JWT with Dynamic in the overview.