title: Login with rvest/httr
body: <p>I am trying manage logging in with httr.</p>
  <p>I have tried the following:</p>
  <pre><code>username&lt;-&quot;email&quot;; password&lt;-&quot;password&quot;
  page&lt;-html_session(&quot;https://www.crowdcube.com/login&quot;)
  page&lt;-request_POST(page,url=page$response$url,
                         body=list(&quot;email&quot;=username,
                                   &quot;password&quot;=password
                                   ,&quot;redirect_url&quot;=&quot;https://www.crowdcube.com&quot;),
                       encode='json',verbose()
                         )
  </code></pre>
  <p>and simply this (I have tried to provide a url to redirect to, but that did not work either):</p>
  <pre><code>x &lt;- POST(&quot;https://www.crowdcube.com/login&quot;, authenticate(username, password),config(followlocation = 0), encode=&quot;json&quot;, verbose())
  </code></pre>
  <p>He is what the latter produced (the first one also triggers 302 error):</p>
  <pre><code>-&gt; POST /login HTTP/1.1
  -&gt; Host: www.crowdcube.com
  -&gt; Authorization: Basic iYmlAbWFpbC5ydToxUnVzc2
  -&gt; User-Agent: libcurl/7.64.1 r-curl/4.0 httr/1.4.1
  -&gt; Accept-Encoding: deflate, gzip
  -&gt; Cookie: CROWDCUBE=g59tvlaq5v5lrpsgogak9; __cfduid=d18fd4953c89e16e5713cff6ba34262
  -&gt; Accept: application/json, text/xml, application/xml, */*
  -&gt; Content-Length: 0
  -&gt; 
  &lt;- HTTP/1.1 302 Found
  &lt;- Date: Thu, 19 Nov 2020 23:59:49 GMT
  &lt;- Content-Type: text/html; charset=UTF-8
  &lt;- Transfer-Encoding: chunked
  &lt;- Connection: keep-alive
  &lt;- X-XSS-Protection: 1; mode=block
  &lt;- Strict-Transport-Security: max-age=15552000
  &lt;- Cache-control: no-store, no-cache
  &lt;- Cache-Control: no-cache
  &lt;- Location: /login
  &lt;- X-Request-Id: 3bf2-5d1b-483d-9f81-a78af46a
  &lt;- x-frame-options: SAMEORIGIN
  &lt;- CF-Cache-Status: DYNAMIC
  &lt;- cf-request-id: 4600000015f00a81e00000
  &lt;- Expect-CT: max-age=604800, report-uri=&quot;https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct&quot;
  &lt;- X-Content-Type-Options: nosniff
  &lt;- Server: cloudflare
  &lt;- CF-RAY: 31cc99215f0-ARN
  </code></pre>
  <p>Rseleniumcan probably manage the problem, but I am trying to avoid it</p>
  <p>Edit in response to @MrFlick. The first version produces the following:</p>
  <pre><code>-&gt; POST /login HTTP/1.1
  -&gt; Host: www.crowdcube.com
  -&gt; User-Agent: libcurl/7.64.1 r-curl/4.0 httr/1.4.1
  -&gt; Accept-Encoding: deflate, gzip
  -&gt; Cookie: AWSALBCORS=fLpF/isCxxMpnt/e2/lc1CGgyln7VFK6uuHNe94mwJKERlhwo8tgXwd0rDlEwZOGdKr6RzYFAvHhk82tgefXSBVqRE7q4le+1H02+QS+a0/eyMlT6vKMBIkpDi5k; CROWDCUBE=rc279ndia8vjstjb95g0l2pvt1; AWSALB=fLpF/isCxxMpnt/e2/lc1CGgyln7VFK6uuHNe94mwJKERlhwo8tgXwd0rDlEwZOGdKr6RzYFAvHhk82tgefXSBVqRE7q4le+1H02+QS+a0/eyMlT6vKMBIkpDi5k; __cfduid=d81f8fe2764634872724f3ea67e9226581605830327
  -&gt; Accept: application/json, text/xml, application/xml, */*
  -&gt; Content-Type: application/json
  -&gt; Content-Length: 92
  -&gt; 
  &gt;&gt; {&quot;email&quot;:&quot;eeeee&quot;,&quot;password&quot;:&quot;ppppp&quot;,&quot;redirect_url&quot;:&quot;https://www.crowdcube.com&quot;}
  
  &lt;- HTTP/1.1 302 Found
  &lt;- Date: Fri, 20 Nov 2020 00:44:39 GMT
  &lt;- Content-Type: text/html; charset=UTF-8
  &lt;- Transfer-Encoding: chunked
  &lt;- Connection: keep-alive
  &lt;- X-XSS-Protection: 1; mode=block
  &lt;- Strict-Transport-Security: max-age=15552000
  &lt;- Cache-control: no-store, no-cache
  &lt;- Cache-Control: no-cache
  &lt;- Location: /login
  &lt;- X-Request-Id: 5eaeee34-f6e1-474c-96bf-f9185226fc78
  &lt;- x-frame-options: SAMEORIGIN
  &lt;- CF-Cache-Status: DYNAMIC
  &lt;- cf-request-id: 0684b5538d00001c06f2970000000001
  &lt;- Expect-CT: max-age=604800, report-uri=&quot;https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct&quot;
  &lt;- X-Content-Type-Options: nosniff
  &lt;- Server: cloudflare
  &lt;- CF-RAY: 5f4e24cc1f471c06-OSL
  &lt;- 
  -&gt; GET /login HTTP/1.1
  -&gt; Host: www.crowdcube.com
  -&gt; User-Agent: libcurl/7.64.1 r-curl/4.0 httr/1.4.1
  -&gt; Accept-Encoding: deflate, gzip
  -&gt; Referer: https://www.crowdcube.com/login
  -&gt; Cookie: AWSALBCORS=fLpF/isCxxMpnt/e2/lc1CGgyln7VFK6uuHNe94mwJKERlhwo8tgXwd0rDlEwZOGdKr6RzYFAvHhk82tgefXSBVqRE7q4le+1H02+QS+a0/eyMlT6vKMBIkpDi5k; CROWDCUBE=rc279ndia8vjstjb95g0l2pvt1; AWSALB=fLpF/isCxxMpnt/e2/lc1CGgyln7VFK6uuHNe94mwJKERlhwo8tgXwd0rDlEwZOGdKr6RzYFAvHhk82tgefXSBVqRE7q4le+1H02+QS+a0/eyMlT6vKMBIkpDi5k; __cfduid=d81f8fe2764634872724f3ea67e9226581605830327
  -&gt; Accept: application/json, text/xml, application/xml, */*
  -&gt; Content-Type: application/json
  -&gt; 
  &lt;- HTTP/1.1 200 OK
  &lt;- Date: Fri, 20 Nov 2020 00:44:39 GMT
  &lt;- Content-Type: text/html; charset=UTF-8
  &lt;- Transfer-Encoding: chunked
  &lt;- Connection: keep-alive
  &lt;- X-XSS-Protection: 1; mode=block
  &lt;- Strict-Transport-Security: max-age=15552000
  &lt;- Cache-control: no-store, no-cache
  &lt;- Cache-Control: no-cache
  &lt;- X-Request-Id: fda74a48-75a0-4420-98b5-d565b1dc8df8
  &lt;- x-frame-options: SAMEORIGIN
  &lt;- CF-Cache-Status: DYNAMIC
  &lt;- cf-request-id: 0684b5542300001c06f7b5d000000001
  &lt;- Expect-CT: max-age=604800, report-uri=&quot;https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct&quot;
  &lt;- X-Content-Type-Options: nosniff
  &lt;- Server: cloudflare
  &lt;- CF-RAY: 5f4e24cd08101c06-OSL
  &lt;- Content-Encoding: gzip
  </code></pre>