I know I can log in fine because I can return $b, which was set as $r->as_string, and do so from a browser running the script, so I get the page that shows up when I am logged in.
What can add_cookie_header($request) or extract_cookies($response) do for me? I have never used those. Thanks for your help and time!