UNPKG

liveperson-functions-client

Version:

JavaScript client for LivePerson Functions.

34 lines 1.16 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.getBearer = void 0; const got_1 = __importDefault(require("got")); const agentVep = 'staging.agentvep.liveperson.net'; async function getBearer(accountId, username, password) { var _a; try { const resp = await (0, got_1.default)(`https://${agentVep}/api/account/${accountId}/login?v=1.3`, { method: 'post', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ username, password, }), resolveBodyOnly: false, responseType: 'json', throwHttpErrors: false, }); // @ts-ignore return ((_a = resp === null || resp === void 0 ? void 0 : resp.body) === null || _a === void 0 ? void 0 : _a.bearer) || ""; } catch (e) { console.log(e); return ''; } } exports.getBearer = getBearer; //# sourceMappingURL=helper.js.map