Remember me CookieAuth decryption issues

I have followed the documentation to implement the remember_me token.
https://book.cakephp.org/authentication/2/en/authenticators.html#cookie-authenticator-aka-remember-me

When I login for the first time, I can see that the CookieAuth cookie is created. But when I return to the page afterwards, the authentication result is FAILURE_CREDENTIALS_INVALID. The result originates from CookieAuthenticator::authenticate.

When I look into it a bit more, I can see that the reason for the failed result is that the $token (which I believe should be the decrypted CookieAuth) is an empty string. When I follow the decryption of CookieAuth through EncryptedCookieMiddleware.php, I end up at OpenSsl::decrypt. It is at this point that decrypting the token doesn’t seem to work. All the parameters for openssl_decrypt() are filled, but it results in an empty string.

I am unsure as to why there are problems with decrypting the cookie.

As a sidenote, I generated the 32 byte cookieKey at Encryption Key Generator