Skip to content

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.

Parameter Type
secret TokenSecret
applicationKey string
options? PortalTokenOptions

Promise<string>

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} />.