IncomingMessage/ServerResponse)
and Fetch API (Request/Response) request/response objects.
Create an instance with CrossmintAuthServer.from.
Extends
CrossmintAuth
Methods
getJwksUri()
getJwksUri(): string
Defined in: common/auth/dist/CrossmintAuth.d.ts:14
Returns
string
Inherited from
CrossmintAuth.getJwksUri
getSession()
getSession(Defined in: server/src/auth/CrossmintAuthServer.ts:59 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
| Parameter | Type |
|---|---|
options | GenericRequest | AuthMaterialBasic |
response? | GenericResponse |
Returns
Promise<AuthSession>
Throws
CrossmintAuthenticationError if no valid session can be established.getUser()
getUser(Defined in: server/src/auth/CrossmintAuthServer.ts:86 Fetch the Crossmint user associated with the given external user ID.externalUserId):Promise<any>
Parameters
| Parameter | Type |
|---|---|
externalUserId | string |
Returns
Promise<any>
handleCustomRefresh()
handleCustomRefresh(Defined in: server/src/auth/CrossmintAuthServer.ts:102 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
| Parameter | Type |
|---|---|
request | GenericRequest |
response? | GenericResponse |
Returns
Promise<GenericResponse>
logout()
logout(Defined in: server/src/auth/CrossmintAuthServer.ts:167 Log the user out: invalidate the refresh token with Crossmint and clear the auth cookies on the response.request?,response?):Promise<GenericResponse>
Parameters
| Parameter | Type |
|---|---|
request? | GenericRequest |
response? | GenericResponse |
Returns
Promise<GenericResponse>
storeAuthMaterial()
storeAuthMaterial(Defined in: server/src/auth/CrossmintAuthServer.ts:162 Store auth material (JWT and refresh token) in the response’s cookies.response,authMaterial):void
Parameters
| Parameter | Type |
|---|---|
response | GenericResponse |
authMaterial | AuthMaterial |
Returns
void
verifyCrossmintJwt()
verifyCrossmintJwt(Defined in: server/src/auth/CrossmintAuthServer.ts:154 Verify a Crossmint-issued JWT and return its decoded payload. Uses Crossmint’s JWKS endpoint unless a key set is provided.token,jwks?):Promise<JWTPayload>
Parameters
| Parameter | Type |
|---|---|
token | string |
jwks? | JSONWebKeySet |
Returns
Promise<JWTPayload>
defaultApiClient()
Defined in: common/auth/dist/CrossmintAuth.d.ts:19staticdefaultApiClient(crossmint):CrossmintApiClient
Parameters
| Parameter | Type |
|---|---|
crossmint | Crossmint |
Returns
CrossmintApiClient
Inherited from
CrossmintAuth.defaultApiClient
from()
Defined in: server/src/auth/CrossmintAuthServer.ts:47 Create astaticfrom(crossmint,options):CrossmintAuthServer
CrossmintAuth instance from a Crossmint object (created with createCrossmint).
Parameters
| Parameter | Type |
|---|---|
crossmint | Crossmint |
options | CrossmintAuthServerOptions |
Returns
CrossmintAuthServer
Overrides
CrossmintAuth.from
