Skip to main content

Function: setToken()

function setToken(cluster: string, token: null | string): Promise<void> | Promise<boolean>

Sets or updates the token for a given cluster using cookie-based storage. The token is stored securely in an HttpOnly cookie on the backend.

Parameters

ParameterTypeDescription
clusterstringThe name of the cluster.
tokennull | stringThe authentication token to set. Pass null to clear the token.

Returns

Promise<void> | Promise<boolean>

Throws

When cluster name is invalid or backend request fails

Defined in

src/lib/auth.ts:108