1

I am using Cakephp 2.3 I want to get the authorization header. I tried using this code:

$this->request->header('Authorization')

It does not show anything while using

$this->request->header('User-Agent')

HTTP_USER_AGENT shows the data. Tried using the apache_request_headers() function, here also all the headers are displayed except the Authorization header. Am I missing something?

VishalParkash
  • 490
  • 3
  • 15
  • 1
    Possibly **[https://book.cakephp.org/3.0/en/controllers/request-response.html#Cake\Network\Request::header](https://book.cakephp.org/3.0/en/controllers/request-response.html#Cake\Network\Request::header)**. The same would apply to CakePHP 2.x – ndm Jan 11 '17 at 17:47
  • Thank you very much. I just fixed it by using this. SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1 in my htaccess file. – VishalParkash Jan 12 '17 at 06:15
  • You may want to post that an as an actual answer thenand accept it later on, this will help future readers that are searching for answers. – ndm Jan 12 '17 at 19:27

1 Answers1

0

I found an answer to the question. If this can help anyone, here is the reference that helped me in solving my problem. The actual logic was the Apache Server, It was hiding the Authorization header for security reasons.

Community
  • 1
  • 1
VishalParkash
  • 490
  • 3
  • 15