Overview
Our server SDK allows you to:- Manage user sessions
- Retrieve user profiles
- Verify JSON Web Tokens (JWTs)
Installation
First, install the Crossmint Server SDK:Initialization
To use Crossmint Auth, you need to initialize it with your Server API key. This API requires theusers.read
scope.
Core Functionality
Session Management
ThegetSession
method validates or refreshes a user’s session based on their JWT and refresh token.
- Fetches the current JWT and refresh token from the cookies with keys
crossmint-jwt
andcrossmint-refresh-token
. - Checks if the current JWT is valid
- Refreshes the session if needed
- Stores the new JWT and refresh token in cookies
- Returns new auth materials and the user ID
For other frameworks that do not expose standard request and response objects, such as Next.js using the App Router, you can pass in an object with
jwt
and refreshToken
properties instead:User Profile Retrieval
Fetch user details using thegetUser
method:
JWT Verification
Verify JWTs independently using theverifyCrossmintJwt
method: