title: Parse access-token using jq
body: <p>Below is the bash-script that i use to parse the json-response from my OAuth provider. My intention is to extract only the <code>access-token</code> from the json response</p>
  <pre class="lang-sh prettyprint-override"><code>CLIENT_ID=MASKED
  CLIENT_SECRET=MASKED
  RESOURCE=MASKED
  
  TOKEN_JSON_RESPONSE=$(
      curl https://corp.company.com/adfs/oauth2/token/ -H 'Accept: application/json' -H 'Content-Type: application/x-www-form-urlencoded' -d 'client_id='$CLIENT_ID'&amp;client_secret='$CLIENT_SECRET'&amp;grant_type=client_credentials&amp;resource='$RESOURCE
  )
  
  echo 'The token response is ' $TOKEN_JSON_RESPONSE
  
  echo ' @@@@@@@@@@@@@@@@@  '
  
  ACCESS_TOKEN=$TOKEN_JSON_RESPONSE | jq '.access_token'
  
  echo 'The access token is '$ACCESS_TOKEN
  </code></pre>
  <p>I am getting the JSON response properly and below is that</p>
  <pre><code>{
     &quot;access_token&quot;:&quot;eyJxxxxxxxx&quot;,
     &quot;token_type&quot;:&quot;bearer&quot;,
     &quot;expires_in&quot;:3600
  }
  </code></pre>
  <p>All that i need is to just to extract the value in the <code>access_token</code> .. Currently in the above script, i get an empty string after using jq-parser</p>
  <p><strong>Update:</strong></p>
  <p>when i directly print this way, it works <code>echo $TOKEN_JSON_RESPONSE|jq '.access_token’</code></p>
  <p>whereas when i put the same in a variable it doesn't work</p>
  <p><code>ACCESS_TOKEN=$TOKEN_JSON_RESPONSE|jq '.access_token’</code>
  <code>echo $ACCESS_TOKEN</code></p>