@c8y/client
Version:
Client application programming interface to access the Cumulocity IoT-Platform REST services.
21 lines • 897 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.NodeJSCookieAuth = void 0;
const MicroserviceClientRequestAuth_js_1 = require("./MicroserviceClientRequestAuth.js");
/**
* Extracts the `authorization` cookie from the `set-cookie` header of a response.
*
* Meant to be used in none browser environments like nodejs which don't deal with cookies.
*/
class NodeJSCookieAuth extends MicroserviceClientRequestAuth_js_1.MicroserviceClientRequestAuth {
constructor(cookieResponse) {
super();
const setCookiesHeader = cookieResponse.headers.get('set-cookie');
if (!setCookiesHeader) {
throw Error('No Cookie set');
}
this.authTokenFromCookie = this.getCookieValue({ cookie: setCookiesHeader }, 'authorization');
}
}
exports.NodeJSCookieAuth = NodeJSCookieAuth;
//# sourceMappingURL=NodeJSCookieAuth.js.map