slim-jwt-auth icon indicating copy to clipboard operation
slim-jwt-auth copied to clipboard

Token not found - Possible fix

Open yanosuke opened this issue 6 years ago • 1 comments

This is more of a future note to myself, as well as a possible fix to someone else.

No matter what I tried, including messing around with the .htaccess file, I was not able to resolve the "Token not found" error. Finally, I enabled PHP-FPM for PHP7.1 and everything was working. Not 100% if this alone fixed the problem, but it certainly made it work for me.

yanosuke avatar Jan 06 '19 08:01 yanosuke

When you are using Fast CGI with Apache, more precisely mod_fcgid, the default configuration will "eat away" your Authorization header before it even reaches your PHP.

You need to set the CGIPassAuth option in you vhost config (read here).

Example:

<VirtualHost *:80>
    DocumentRoot "R:/foo"
    <Directory "R:/foo">
        AddHandler fcgid-script .php
        Options +ExecCGI
        FCGIWrapper "R:/dev/php73/php-cgi.exe -c R:/php/php73/php.ini" .php
        CGIPassAuth on
    </directory>
</VirtualHost>

This will enable your HTTP Authorization headers to reach your PHP interpreter.

Hope this helps.

P.S. Even thoug this reply is related to Apache, there may be a similar option for other servers.

dakujem avatar Jul 01 '19 11:07 dakujem