Skip to content

Unable to set cookie #13

@bcarl314

Description

@bcarl314

I have tried to install this plugin, but do not see any cookies getting set. Below is the setup I'm using:

In src/Controller/AppController.php

`
$this->loadComponent('Auth',[

	 'loginRedirect' => [
		    'controller' => 'Users',
		    'action' => 'dashboard'
	    ],
	    'logoutRedirect' => [
		    'controller' => 'Users',
		    'action' => 'login'
	    ],
	    'authenticate' => [
		    'RememberMe.Cookie' => [
			    'userModel' => 'Users',
			    'fields' => ['username' => 'email', 'password' => 'password'],
			    'inputKey' => 'remember_me',
			    'always' => true,
			    'cookie' => [
				    'name' => 'rememberMe',
				    'expires' => '+90 days',
				    'secure' => true,
				    'httpOnly' => true,
			    ],
		    ],
		    'Form' => [
			    'fields' => ['username' => 'email', 'password' => 'password']
		    ]
	    ]
    ]);

`

In src/Template/Users/login.ctp

`

Form->create() ?>
<fieldset>
	<legend><?= __('Please enter your username and password') ?></legend>
	<?= $this->Form->control('email') ?>
	<?= $this->Form->control('password') ?>
	<?= $this->Form->control('remember_me', ['type' => 'checkbox']) ?>
</fieldset>
<br />
<?= $this->Form->button(__('Login'), ['class' => 'btn btn-success']); ?>


<?= $this->Form->end() ?>

`

When I login (and check the remember me checkbox, I see a new token in the remember_me_tokens with the foreign_id matching my user_id. However, when I examine the cookies, I see nothing set other than the csrfToken.

I must be missing something obvious here, but not seeing it.

CakePHP 3.7 on PHP 7.0.33

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions