Hello
Last year and beginning of this year I developed a lot of features using a token made with an autoaction and stored in a CB Field with this kind of code:
Code:
global $_CB_framework;
// Chiffrement et encodage
$plaintext = (string) \CBLib\Application\Application::MyUser()->getUserId();
$key = $_CB_framework->getCfg('secret') . 'secret_code';
$iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length('AES-256-CBC'));
$ciphertext = openssl_encrypt($plaintext, 'AES-256-CBC', $key, 0, $iv);
$encrypted_data = bin2hex($iv . $ciphertext);
$user->set('cb_token_api', $encrypted_data);
$user->store();
Then we use this code in several autoactions to identify the user.
I would like your feedback about whether to continue using this field and this code, or switch to Joomla token API and use the native joomla token.
Could we get the same results with it ? it is worth switching or sticking to CB autoaction for this ? if yes how can I get the userid in an autoaction with the joomla API token ?
Thanks for your feedback