I'm having trouble migrating my Backend CakePHP App, from CakePHP 3.9 to CakePHP 4.
The App serves as an API for my sveltejs/sapper
Javascript Application.
As for the JWT Authentication I'm using the admad/cakephp-jwt-auth
plugin.
The App before Migration works perfectly from the browser as the frontend. Testing my API in Postman works for both CakePHP 3 and 4 versions.
After migration however, requests sent from the browser (sveltejs/sapper
) and where Authentication is needed (Authorization
header containing the Bearer
token) result in an error:
Error 401 "Authorization failed
My CORS Middleware (ozee31/cakephp-cors
plugin) also seems to be working since requests that don't need to be authorized just work as expected, also from the browser - unplugging CORS middleware result in an CORS error in the browser for those requests.
Also, my server is populating $_SERVER['HTTP_AUTHORIZATION']
Has anyone successfully implemented a similar setup, especially when it comes to CakePHP 4 and HTTP_AUTHORIZATION
header yet?