Issue
i am trying to implement JWT Authentication to a CakePHP 3. i am following below tutorial:
http://www.bravo-kernel.com/2015/04/how-to-add-jwt-authentication-to-a-cakephp-3-rest-api/
i have completed basic setup and it's working good. but when i tried to register a user with the help of Postman it gave me following error:
Error: Call to a member function set() on boolean
File /var/www/html/XXXXXX/vendor/friendsofcake/crud/src/Action/BaseAction.php
Line: 196
my user controller code is:
public function add()
{
$this->Crud->on('afterSave', function(Event $event) {
if ($event->subject->created) {
$this->set('data', [
'id' => $event->subject->entity->id,
'token' => JWT::encode(
[
'sub' => $event->subject->entity->id,
'exp' => time() + 604800
],
Security::salt())
]);
$this->Crud->action()->config('serialize.data', 'data');
}
});
return $this->Crud->execute();
}
please help me
Solution
i just found the issue. i have created all templates with cake bake. so in this case i need add Flash to my components list on AppController.
Answered By - Rajinder
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.