Skip to main content

WalletAuthenticator.generateAuthToken() method

This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

Generate Authentication Token

Example

const domain = "thirdweb.com";
const loginPayload = await sdk.auth.login(domain);

// Generate a JWT token that can be sent to the client-side wallet and used for authentication
const token = await sdk.auth.generateAuthToken(domain, loginPayload);

Signature:

generateAuthToken(domain: string, payload: LoginPayload, options?: AuthenticationOptions): Promise<string>;

Parameters

ParameterTypeDescription
domainstringThe domain of the server-side application to authenticate to
payloadLoginPayloadThe login payload to authenticate with
optionsAuthenticationOptions(Optional) Optional configuration options for the authentication request

Returns:

Promise<string>

A authentication token that can be used by the client to make authenticated requests

Remarks

Server-side function that generates a JWT token from the provided login request that the client-side wallet can use to authenticate to the server-side application.