createPortalToken
function createPortalToken( secret, applicationKey, options?): Promise<string>;Defined in: src/portal.ts:78
Mint a portal token granting access to applicationKey until expiresIn
elapses (default 7 days). Call this server-side — anyone holding the
portal secret can mint tokens for any application.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
secret |
TokenSecret |
applicationKey |
string |
options? |
PortalTokenOptions |
Returns
Section titled “Returns”Promise<string>
Example
Section titled “Example”import { createPortalToken } from "@xtandard/webhooks";
// In the host app's session-guarded route:const token = await createPortalToken(process.env.PORTAL_SECRET!, "acme", { expiresIn: "1h",});// Hand `token` to the frontend for <WebhooksPortal token={token} />.