# Follow Authorization header

**URL:** <https://community.postman.com/t/follow-authorization-header/13027>\
**Category:** Help Hub\
**Tags:** tests, collections, authentication\
**Created:** [June 1, 2020, 1:07pm UTC](https://community.postman.com/t/follow-authorization-header/13027 "2020-06-01T13:07:27Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![team.attractive0](https://avatars.discourse-cdn.com/v4/letter/t/bb73d2/32.png) [@team.attractive0](https://community.postman.com/u/team.attractive0)\
**Post date:** [June 1, 2020, 1:07pm UTC](https://community.postman.com/t/follow-authorization-header/13027/1 "2020-06-01T13:07:27Z")

</div>

Hi Team,

I’m happy if you help me here. I’m just trying to get code in PHP(curl). But the issue is how to " **Retain authorization header when a redirect happens to a different hostname.**" But no changes are done when I’m coping PHP code of my request. How to code that in the PHP curl file.

_\<?php_

 

$curl = curl\_init();

curl\_setopt\_array($curl, array(  
CURLOPT\_URL =\> “[https://resmed-agm--sit.cs37.my.salesforce.com/services/apexrest/api/hubspot/v1/HubspotAPI\_SleepQuiz](https://resmed-agm--sit.cs37.my.salesforce.com/services/apexrest/api/hubspot/v1/HubspotAPI_SleepQuiz)”,  
CURLOPT\_RETURNTRANSFER =\> true,  
CURLOPT\_ENCODING =\> “”,  
CURLOPT\_MAXREDIRS =\> 10,  
CURLOPT\_TIMEOUT =\> 0,  
CURLOPT\_FOLLOWLOCATION =\> true,  
CURLOPT\_HTTP\_VERSION =\> CURL\_HTTP\_VERSION\_1\_1,  
CURLOPT\_CUSTOMREQUEST =\> “POST”,  
CURLOPT\_POSTFIELDS =\>"{\n “email”: “[testsalesapi@gmail.com](mailto:testsalesapi@gmail.com)”,\n “name”: “Shivasagar”,\n “phone”: “8861760420”}",  
CURLOPT\_HTTPHEADER =\> array(  
“Authorization: OAuth access\_token”,  
“Content-Type: application/json”,  
“Cookie: BrowserId=KnNiRKC5EeqFJ0UJd0AmeQ”  
),  
));

$response = curl\_exec($curl);

_curl\_close($curl);  
echo $response;_

---

<div class="post-metadata">

**Author:** ![kinlane](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/kinlane/32/347_2.png) [@kinlane](https://community.postman.com/u/kinlane)\
**Post date:** [June 1, 2020, 8:33pm UTC](https://community.postman.com/t/follow-authorization-header/13027/2 "2020-06-01T20:33:46Z")

</div>

I don’t see any verification that all headers are passed with each redirect. To do this I recommend capturing the response headers, and writing your own logic for retrying. That way you can have full control over headers passed with each response.

If you built this as a Postman collection, you could build your retry logic as a Test Script.
