title: How to send requests using custom cookies with Request-promise
body: <p>I am working on a print app and I need to get some data from a protected resources.
  the only way I can be signed in is using a browser so I am using phantom as browser.
  I manged to sign in and get the cookies but I don't know how to use the cookies with request-promise to send the requests with the cookies I got when I signed in.</p>
  
  <p>Here is my simplified code:</p>
  
  <pre><code>import * as phantom from "phantom";
  import * as requestPromise from "request-promise-native";
  requestPromise.defaults({ rejectUnauthorized: false });
  
  (async function () {
      const instance = await phantom.create([
          "--ignore-ssl-errors=true",
          "--cookies-file=cookies.txt",
          "--web-security=false",
          "--ssl-protocol=any"
      ]);
      const page = await instance.createPage();
      const status = await page.open("http://localhost:3000/auth/login-html");
      console.log("status", status);
  
      let result = await page.evaluate(() =&gt; {
          (document.getElementById("username") as HTMLInputElement).value = "test@email.com";
          (document.getElementById("password") as HTMLInputElement).value="password";
          (document.getElementById("login") as HTMLElement).click();
  
          return true;
      });
      // Get the cookies 
  
      let cookies = await page.property("cookies");
      console.log(cookies)
      /** [{ domain: 'my-app-resource-domain.com',
          httponly: true,
          name: 'ticket',
          path: '/',
          secure: false,
          value: '6823a-78c0a4ee82c0' },
          { domain: 'my-app-resource-domain.com',
          httponly: true,
          name: 'JSESSIONID',
          path: '/',
          secure: false,
          value: '9CB8396A05ABA178' }] **/
      let cookiesSring = getStringCookies(cookies) // "ticket=6823a-78c0a4ee82c0&amp;JSESSIONID=9CB8396A05ABA178"
      requestPromise.cookie(cookiesSring );
  
      // Send request to get data from protected resource 
      let res = await requestPromise.get("http://my-app-resource-domain.com/api/get-charts")
  })();
  </code></pre>