IncomingMessage/ServerResponse)
and Fetch API (Request/Response) request/response objects.
Create an instance with CrossmintAuthServer.from.
Extends
CrossmintAuth
Methods
getJwksUri()
getJwksUri(): string
Defined in: packages/common/auth/dist/CrossmintAuth.d.ts:19
Returns
string
Inherited from
CrossmintAuth.getJwksUri
getSession()
getSession(Defined in: packages/server/src/auth/CrossmintAuthServer.ts:66 Validate the user’s session and return it, refreshing it if expired. Accepts either a request object (auth material is read from cookies) or the auth material itself (options,response?):Promise<AuthSession>
{ jwt, refreshToken }). If a response object is provided, refreshed auth material
is stored in its cookies.
Parameters
Returns
Promise<AuthSession>
Throws
CrossmintAuthenticationError if no valid session can be established.getUser()
getUser(Defined in: packages/server/src/auth/CrossmintAuthServer.ts:93 Fetch the Crossmint user associated with the given external user ID.externalUserId):Promise<any>
Parameters
Returns
Promise<any>
handleCustomRefresh()
handleCustomRefresh(Defined in: packages/server/src/auth/CrossmintAuthServer.ts:109 Handle a token refresh request on a custom refresh route. Reads the refresh token from the request body or cookies, refreshes the session, and returns a response with the new auth material stored in cookies. Returns a 401 response if the refresh fails.request,response?):Promise<GenericResponse>
Parameters
Returns
Promise<GenericResponse>
logout()
logout(Defined in: packages/server/src/auth/CrossmintAuthServer.ts:182 Log the user out: invalidate the refresh token with Crossmint and clear the auth cookies on the response.request?,response?):Promise<GenericResponse>
Parameters
Returns
Promise<GenericResponse>
storeAuthMaterial()
storeAuthMaterial(Defined in: packages/server/src/auth/CrossmintAuthServer.ts:177 Store auth material (JWT and refresh token) in the response’s cookies.response,authMaterial):void
Parameters
Returns
void
verifyCrossmintJwt()
verifyCrossmintJwt(Defined in: packages/server/src/auth/CrossmintAuthServer.ts:169 Verify a Crossmint-issued JWT and return its decoded payload — checks the signature, expiry, and that it was issued for this project (token,jwks?):Promise<JWTPayload>
aud matches the API key’s project ID).
Uses Crossmint’s JWKS endpoint unless a key set is provided.
Parameters
Returns
Promise<JWTPayload>
defaultApiClient()
Defined in: packages/common/auth/dist/CrossmintAuth.d.ts:24staticdefaultApiClient(crossmint):CrossmintApiClient
Parameters
Returns
CrossmintApiClient
Inherited from
CrossmintAuth.defaultApiClient
from()
Defined in: packages/server/src/auth/CrossmintAuthServer.ts:54 Create astaticfrom(crossmint,options):CrossmintAuthServer
CrossmintAuth instance from a Crossmint object (created with createCrossmint).
Parameters
Returns
CrossmintAuthServer
Overrides
CrossmintAuth.from
