1

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

2

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

2 Comments

Exactly this is what it should be like - but its not working! Both are empty.....
@Tobi It looks like there are some hints in the comments on the article I linked to. Try searching for "apache" on that page.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.