UNPKG

migros-api-wrapper

Version:

Making the api of migros more accessible to the public.

27 lines 998 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getGuestToken = void 0; const requests_1 = require("../../utils/requests"); const apiPaths_1 = require("../apiPaths"); const url = apiPaths_1.migrosApiPaths["authentication"].public.v1 + "/guest"; const defaultAuthenticationOptions = { authorizationNotRequired: true, }; async function getGuestTokenRequest(url, options) { const necessaryHeaders = { ["accept"]: "application/json, text/plain, */*", }; const response = await (0, requests_1.getRequestBypass)(url, options, necessaryHeaders); if (!response.headers["leshopch"]) { throw new Error("No guest token found in the response headers."); } return { token: response.headers["leshopch"], body: response.data, }; } async function getGuestToken() { return getGuestTokenRequest(url, defaultAuthenticationOptions); } exports.getGuestToken = getGuestToken; //# sourceMappingURL=guest-token.js.map