Home Ask Login Register

Developers Planet

Your answer is one click away!

Manveru February 2016

PHP not see Authorization header

I have an application which use OAtuth2, and I recognized that there is a problem with Authorization header. Because in php script I can't read this header.
The header is sent correctly(Firebug network):

Accept          application/json, text/plain, */*
Accept-Encoding gzip, deflate
Accept-Language pl,en-US;q=0.7,en;q=0.3
Authorization   Bearer 3213826ad9147747f3927feca675e3aeee7d0306
Cache-Control   max-age=0
Connection      keep-alive
Cookie          __utma=269300334.55671391.1445337979.1448456981.1453303397.4; __utmz=269300334.1453303397.4.3.utmcsr **strong text**=haynet.pl|utmccn=(referral)|utmcmd=referral|utmcct=/; _ga=GA1.2.55671391.1445337979; PHPSESSID=m3e64vsduq8vpacfhvnfka66k1; _gat=1
Host            pze2.biuro.netivo.pl
Referer         http://pze2.biuro.netivo.pl/
User-Agent      Mozilla/5.0 (Windows NT 10.0; WOW64; rv:43.0) Gecko/20100101 Firefox/43.0

But when I'm calling getallheaders() function or apache_request_headers() function I don't see Authorization header,(response print from apache_request_headers()):

array(10) {
  ["Accept"]=>
  string(33) "application/json, text/plain, */*"
  ["Accept-Encoding"]=>
  string(13) "gzip, deflate"
  ["Accept-Language"]=>
  string(23) "pl,en-US;q=0.7,en;q=0.3"
  ["Cache-Control"]=>
  string(9) "max-age=0"
  ["Connection"]=>
  string(10) "keep-alive"
  ["Cookie"]=>
  string(230) "__utma=269300334.55671391.1445337979.1448456981.1453303397.4; __utmz=269300334.1453303397
.4.3.utmcsr=haynet.pl|utmccn=(referral)|utmcmd=referral|utmcct=/; _ga=GA1.2.55671391.1445337979; PHPSESSID
=m3e64vsduq8vpacfhvnfka66k1; _gat=1"
  ["Host"]=>
  string(20) "pze2.biuro.netivo.pl"
  ["Referer"]=>
  string(28) "http://pze2.biuro.netivo.pl/"
  ["User-Agent"]=>
  string(73) "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:43.0) Gecko/20100101 Firefox/43.0"
  ["X-Prerender-Token"]=>
  string(20) "rVnH5kFzvZM1HbRkqZDU"
}

Dumping $_SERVER var not s

Answers


Manveru February 2016

OK I found an answer. For those who will look up form solution, just add to your htaccess:

SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1

In my case it helped.

Post Status

Asked in February 2016
Viewed 2,552 times
Voted 14
Answered 1 times

Search




Leave an answer


Quote of the day: live life