UNPKG

@arc-publishing/sdk-identity

Version:
24 lines 1.2 kB
import { __assign, __awaiter, __generator } from "tslib"; import { headers } from './constants'; import { isAPIErrorResponse } from '../serviceHelpers/APIErrorResponse'; import Identity from './identity'; import JSONResponseHandler from '../serviceHelpers/JSONResponseHandler'; export var loginWithArcIdentityAsOIDCProvider = function (params) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) { return [2, fetch("".concat(Identity.apiOrigin, "/identity/public/v2/oidc/provider/login?") + new URLSearchParams(params), { method: 'GET', headers: __assign({ Authorization: "Bearer ".concat(Identity.userIdentity.accessToken) }, headers) }) .then(JSONResponseHandler) .then(function (res) { if (isAPIErrorResponse(res)) { throw res; } else { window.location.href = res === null || res === void 0 ? void 0 : res.message; } })]; }); }); }; export default loginWithArcIdentityAsOIDCProvider; //# sourceMappingURL=loginWithArcIdentityAsOIDCProvider.js.map