UNPKG

@unkey/api

Version:

Developer-friendly & type-safe Typescript SDK specifically catered to leverage *@unkey/api* API.

42 lines 1.7 kB
/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { portalCreateSession } from "../funcs/portalCreateSession.js"; import { portalExchangeSession } from "../funcs/portalExchangeSession.js"; import { ClientSDK } from "../lib/sdks.js"; import { unwrapAsync } from "../types/fp.js"; export class Portal extends ClientSDK { /** * Create portal session * * @remarks * Create a short-lived session token for an end user to access the Customer Portal. * * The returned session ID is valid for 15 minutes and can be exchanged exactly once * for a 24-hour browser session via `portal.exchangeSession`. Redirect the end user * to the returned URL to start the portal experience. * * **Required Permissions** * * Your root key must be associated with a workspace that has an enabled portal configuration. */ async createSession(request, options) { return unwrapAsync(portalCreateSession(this, request, options)); } /** * Exchange session token * * @remarks * Exchange a short-lived session token for a long-lived browser session. * * This endpoint is unauthenticated. The session token itself serves as proof of authorization. * Each token can only be exchanged once; subsequent attempts return 401. * * The returned browser session token is valid for 24 hours and should be stored as an * httpOnly cookie or used in the Authorization header for subsequent API calls. */ async exchangeSession(request, options) { return unwrapAsync(portalExchangeSession(this, request, options)); } } //# sourceMappingURL=portal.js.map