UNPKG

@unkey/api

Version:

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

46 lines 1.93 kB
"use strict"; /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ Object.defineProperty(exports, "__esModule", { value: true }); exports.Portal = void 0; const portalCreateSession_js_1 = require("../funcs/portalCreateSession.js"); const portalExchangeSession_js_1 = require("../funcs/portalExchangeSession.js"); const sdks_js_1 = require("../lib/sdks.js"); const fp_js_1 = require("../types/fp.js"); class Portal extends sdks_js_1.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 (0, fp_js_1.unwrapAsync)((0, portalCreateSession_js_1.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 (0, fp_js_1.unwrapAsync)((0, portalExchangeSession_js_1.portalExchangeSession)(this, request, options)); } } exports.Portal = Portal; //# sourceMappingURL=portal.js.map