@c8y/client
Version:
Client application programming interface to access the Cumulocity IoT-Platform REST services.
17 lines • 703 B
JavaScript
import { MicroserviceClientRequestAuth } from './MicroserviceClientRequestAuth';
/**
* 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.
*/
export class NodeJSCookieAuth extends 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');
}
}
//# sourceMappingURL=NodeJSCookieAuth.js.map