Using cookie authentication with REST driver

I'm in the process of setting up a driver to connect with a REST endpoint where authentication is handled through cookies. Does anyone else here have experience with such a setup?

The main challenge, as I see it, is that when doing a call to the authentication service, the cookie returned will be in the response header, but I haven't found a good way to extract/catch the headers from the response.

Once I have the cookie in a driver variable, adding it to the header of outgoing requests should be straight-forward