Hey,
I'm trying to my prestashop API on my cpanel server, but when I''m typing my api key as username in basic auth I have login loop.
This same is with my custom PHP file - cannot login via basic auth, because I have login loop (after send data from dialog box this are refreshing and showing dialog box again)
PHP example:
In httaccess I have:
I'm trying to my prestashop API on my cpanel server, but when I''m typing my api key as username in basic auth I have login loop.
This same is with my custom PHP file - cannot login via basic auth, because I have login loop (after send data from dialog box this are refreshing and showing dialog box again)
PHP example:
Code:
public function checkAuth()
{
if (PHP_SAPI === 'cli' ||
empty($this->login)
) {
return;
}
if (!isset($_SERVER['PHP_AUTH_USER']) ||
$_SERVER['PHP_AUTH_PW'] != $this->password ||
$_SERVER['PHP_AUTH_USER'] != $this->login
) {
header('WWW-Authenticate: Basic realm="Authentification"');
header('HTTP/1.0 401 Unauthorized');
echo '401 Unauthorized';
exit(401);
}
}
Code:
<IfModule mod_fcgid.c>
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]