I am trying to configure JSON Web Tokens to communicate with my php server from a mobile application. I can request a token just fine. When I need to check it (or make a request to another endpoint), I configure the authorization header in the following format:
Bearer <token here>
But for some reason my backend is $_SERVER['HTTP_AUTHORIZATION']not installed.
I am on localhost using Mamp Pro with PHP7. This is a dump for my array $_SERVER:
Array
(
[SERVER_SOFTWARE] => Apache
[REQUEST_URI] => /wp-json/jwt-auth/v1/token/validate/
[REDIRECT_STATUS] => 200
[HTTP_HOST] => localhost.dev
[CONTENT_TYPE] => application/x-www-form-urlencoded
[CONTENT_LENGTH] => 54
[HTTP_CONNECTION] => keep-alive
[HTTP_ACCEPT] => *
When I try to use HTTP authentication using Basic dGVzdEB0ZXN0LmNvbToxMjM0NQ==as the authorization header, it works fine:
[PHP_AUTH_USER] => test@test.com
[PHP_AUTH_PW] => 12345
Any idea what is wrong?
source
share