Hi All,
I am developing an api using yii2 REST Api basicauth. I have successfully developed in my local xampp server. I have deployed the code to a vps running centos. But i am getting the following unathorized response:
{
"name": "Unauthorized",
"message": "Your request was made with invalid credentials.",
"code": 0,
"status": 401,
"type": "yii\\web\\UnauthorizedHttpException"
}
I have set the headers properly.
response headers:
Connection →Keep-Alive
Content-Type →application/json; charset=UTF-8
Date →Fri, 05 May 2017 08:40:49 GMT
Keep-Alive →timeout=5, max=100
Server →Apache
Transfer-Encoding →chunked
Www-Authenticate →Basic realm="api"
X-Powered-By →PHP/5.6.30
when i dump the headers i dont see the Authorization Header:
object(yii\web\HeaderCollection)#81 (1) {
["_headers":"yii\web\HeaderCollection":private]=>
array(10) {
["host"]=>
array(1) {
[0]=>
string(22) "avenierrpharma-api.dev"
}
["connection"]=>
array(1) {
[0]=>
string(10) "keep-alive"
}
["user-agent"]=>
array(1) {
[0]=>
string(113) "Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.96 Safari/537.36"
}
["cache-control"]=>
array(1) {
[0]=>
string(<img src='http://www.yiiframework.com/forum/public/style_emoticons/default/cool.gif' class='bbc_emoticon' alt='8)' /> "no-cache"
}
["content-type"]=>
array(1) {
[0]=>
string(33) "application/x-www-form-urlencoded"
}
["authorization"]=>
array(1) {
[0]=>
string(30) "Basic O2zbBtP1yVNpXx2xZhJbNxuR"
}
["postman-token"]=>
array(1) {
[0]=>
string(36) "e6918220-a026-e143-c7ae-bc09e0927c54"
}
["accept"]=>
array(1) {
[0]=>
string(3) "*/*"
}
["accept-encoding"]=>
array(1) {
[0]=>
string(19) "gzip, deflate, sdch"
}
["accept-language"]=>
array(1) {
[0]=>
string(14) "en-US,en;q=0.8"
}
}
}
any idea why this is happening in the remote server ? Please help.