title: Cypress : How can we write GET request in with bearer token in cypress?
body: <p>I have two requests: one is POST request and other is get. In first i get user access token by post and in other i used this accessToken to get login. My code does not work.</p>
  <p>I am using window 7 and cypress 3.3.5</p>
  <p>my code:</p>
  <pre><code>var value;
  describe(&quot;Login operation&quot;, () =&gt; {
    it(&quot;Login Request with post method&quot;, () =&gt; {
      cy.request({
        method:'POST', 
        url:'https://odms.baitussalam.org:8445/api/v1/auth/login',
        body: {
          &quot;userName&quot;: &quot;faizanj&quot;,
          &quot;password&quot;: &quot;abc&quot;
        }
      })
        .then(function(response){
          this.value = response.body.accessToken;
          console.log(&quot;Value &quot;+this.value);
  
          expect(response.body.name).to.equal('Faizan');
          expect(response.status).to.equal(200);
        });
    });
  
    it('Second test case', function() {
  
      var authHeader='bearer ${'+this.value+'}';
      const options = {
        method: 'GET',
        url: `https://odms.baitussalam.org:8445/api/v1/qurbani-representative`,
        headers:{
          authorization:authHeader,
        }};
  
      cy.request(options)
        .then((response)=&gt;{
          expect(response.status).to.equal(200);6+9
        });
    });
  });
  </code></pre>