{"action":"created","issue":{"url":"https://api.github.com/repos/tuupola/slim-jwt-auth/issues/14","labels_url":"https://api.github.com/repos/tuupola/slim-jwt-auth/issues/14/labels{/name}","comments_url":"https://api.github.com/repos/tuupola/slim-jwt-auth/issues/14/comments","events_url":"https://api.github.com/repos/tuupola/slim-jwt-auth/issues/14/events","html_url":"https://github.com/tuupola/slim-jwt-auth/issues/14","id":114249540,"number":14,"title":"Token not found / apache / php","user":{"login":"927pm","id":1199231,"avatar_url":"https://avatars.githubusercontent.com/u/1199231?v=3","gravatar_id":"","url":"https://api.github.com/users/927pm","html_url":"https://github.com/927pm","followers_url":"https://api.github.com/users/927pm/followers","following_url":"https://api.github.com/users/927pm/following{/other_user}","gists_url":"https://api.github.com/users/927pm/gists{/gist_id}","starred_url":"https://api.github.com/users/927pm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/927pm/subscriptions","organizations_url":"https://api.github.com/users/927pm/orgs","repos_url":"https://api.github.com/users/927pm/repos","events_url":"https://api.github.com/users/927pm/events{/privacy}","received_events_url":"https://api.github.com/users/927pm/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/tuupola/slim-jwt-auth/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":16,"created_at":"2015-10-30T11:09:04Z","updated_at":"2016-02-01T10:32:16Z","closed_at":null,"body":"On my Slim setup (v3) with php 5.6.14, token can't be found, i need to get it via apache_request_headers() and set $_SERVER['HTTP_AUTHORIZATION']  in index.php. I've tried different .htaccess directives like the one provided [here](http://www.appelsiini.net/projects/slim-jwt-auth) without success.\r\n\r\nWould it be possible to check if  token can be found in 'apache_request_headers' ?\r\n\r\n```php\r\n/**\r\n * Fetch the access token\r\n *\r\n * @return string|null Base64 encoded JSON Web Token or null if not found.\r\n */\r\npublic function fetchToken(RequestInterface $request) \r\n{\r\n    \r\n   /* If using PHP in CGI mode and non standard environment */\r\n    $server_params = $request->getServerParams();\r\n    if (isset($server_params[ $this->options[\"environment\"]])) \r\n    {\r\n        $message = \"Using token from environent\";\r\n        $header = $server_params[ $this->options[\"environment\"]];\r\n    }\r\n    \r\n    $header = $request->getHeader(\"Authorization\");\r\n    if (isset($header[0])) \r\n    {\r\n        $message = \"Using token from request header\";\r\n        $header = isset($header[0]) ? $header[0] : \"\";\r\n    }\r\n    \r\n    /* FIX for apache */\r\n    if (function_exists('apache_request_headers')) \r\n    {\r\n        $headers = apache_request_headers();\r\n        $header = isset($headers['Authorization']) ? $headers['Authorization'] : \"\";\r\n    }\r\n    \r\n    if (preg_match(\"/Bearer\\s+(.*)$/i\", $header, $matches)) \r\n    {\r\n        $this->log(LogLevel::DEBUG, $message);\r\n        return $matches[1];\r\n    }\r\n    \r\n    /* Bearer not found, try a cookie. */\r\n    $cookie_params = $request->getCookieParams();\r\n    \r\n    if (isset($cookie_params[ $this->options[\"cookie\"]])) \r\n    {\r\n        $this->log(LogLevel::DEBUG, \"Using token from cookie\");\r\n        $this->log(LogLevel::DEBUG, $cookie_params[ $this->options[\"cookie\"]]);\r\n        return $cookie_params[ $this->options[\"cookie\"]];\r\n    };\r\n    \r\n    /* If everything fails log and return false. */\r\n    $this->message = \"Token not found\";\r\n    $this->log(LogLevel::WARNING, $this->message);\r\n    return false;\r\n}\r\n\r\n```\r\n "},"comment":{"url":"https://api.github.com/repos/tuupola/slim-jwt-auth/issues/comments/177900935","html_url":"https://github.com/tuupola/slim-jwt-auth/issues/14#issuecomment-177900935","issue_url":"https://api.github.com/repos/tuupola/slim-jwt-auth/issues/14","id":177900935,"user":{"login":"ronaldo-systemar","id":12615817,"avatar_url":"https://avatars.githubusercontent.com/u/12615817?v=3","gravatar_id":"","url":"https://api.github.com/users/ronaldo-systemar","html_url":"https://github.com/ronaldo-systemar","followers_url":"https://api.github.com/users/ronaldo-systemar/followers","following_url":"https://api.github.com/users/ronaldo-systemar/following{/other_user}","gists_url":"https://api.github.com/users/ronaldo-systemar/gists{/gist_id}","starred_url":"https://api.github.com/users/ronaldo-systemar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ronaldo-systemar/subscriptions","organizations_url":"https://api.github.com/users/ronaldo-systemar/orgs","repos_url":"https://api.github.com/users/ronaldo-systemar/repos","events_url":"https://api.github.com/users/ronaldo-systemar/events{/privacy}","received_events_url":"https://api.github.com/users/ronaldo-systemar/received_events","type":"User","site_admin":false},"created_at":"2016-02-01T10:32:16Z","updated_at":"2016-02-01T10:32:16Z","body":":+1: Hope helped.\r\n\r\nNice coding for all."}}