Reputation: 11
I'm using Fat Free Framework for a small RESTful API. I want the user to authenticate for each requests with HTTP Basic Auth like this:
http://user:sha1(pass)@server.org/[...]
My problem is that I can't get these credentials. Our client (Browser: AJAX Request with jQuery) sends them 100%, but I cant find anything in $_SERVER in PHP.
It looks like Apache doesn't forward user + pass to PHP.
Does anyone know why not? And how I can realize HTTP Basic Auth with PHP?
best regards
Upvotes: 1
Views: 7506
Reputation: 2289
You should be able to find the username and password in $_SERVER['PHP_AUTH_USER']
and $_SERVER['PHP_AUTH_PW']
.
There's a great article on php.net on this topic: http://php.net/manual/en/features.http-auth.php
Upvotes: 1