php-jwt icon indicating copy to clipboard operation
php-jwt copied to clipboard

Is there way way to load the token from Cookie?

Open russmenum opened this issue 9 months ago • 0 comments

in src/Controller/AppController.php

$this->loadComponent('Auth', [
            'storage' => 'Memory',
            'authenticate' => [
                'Form' => [
                    'scope' => ['Users.active' => 1]
                ],
                'ADmad/JwtAuth.Jwt' => [
                    'parameter' => 'token',
                    'userModel' => 'Users',
                    'scope' => ['Users.active' => 1],
                    'fields' => [
                        'username' => 'id'
                    ],
                    'queryDatasource' => true
                ]
            ],
            'unauthorizedRedirect' => false,//meed to == ?true for CAKELOG IN? ELSE == ?FALSE
            'checkAuthIn' => 'Controller.initialize'
        ]);

works fine so long as the HEADER has "Authorization", `Bearer ${token}, but for HTTP requests you can not apend the REQ header like this, you can send the value in the cookies, but I am lost where you would do a IF not in header LOOK for valule in a cookie...

The result is not web views can be secure because you can not pass the token by header and can not read it by cookie

russmenum avatar Nov 14 '23 19:11 russmenum