api: Can't get Basic Auth to work

I’m having some troubles with the authentication layer. No matter what I try, I can not use the laravel 4.2 basic auth functionality.

I protected my route in the constructor and this is the response after making a post request with postman:

{"message":"Invalid authentication credentials.","status_code":401}

I’m using 0.8.2

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 16 (3 by maintainers)

Most upvoted comments

Hi @Ortix92,

I experienced the same thing. How does your webserver configuration look like? It might be that the authorization headers are not sent. I’m using Apache and had to add the following for this to work

RewriteCond %{HTTP:Authorization} ^(.*)
RewriteRule .* - [e=HTTP_AUTHORIZATION:%1]

Hi @Ortix92,

You might want to add the following to your .htaccess file:

RewriteCond %{HTTP:Authorization} ^(.*)
RewriteRule .* - [e=HTTP_AUTHORIZATION:%1]

As mentioned also by everybody here, the http headers are not set and the above will correct that.

Sacha