CB login authentication token

11 months 4 weeks ago #333364 by activha
Replied by activha on topic CB login authentication token
Did you check on Joomla 4.2 because I cannot get it to work in an autoaction ?

Please Log in to join the conversation.

11 months 4 weeks ago #333367 by krileon
Replied by krileon on topic CB login authentication token
It is an untested example as noted above. Enable debug mode in the auto action and see if it's throwing an error.

As for the Joomla API yes it works as it's in CB Activity 6.0.0 being used to pass around encrypted stream assets.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.
The following user(s) said Thank You: activha

Please Log in to join the conversation.

11 months 4 weeks ago - 11 months 4 weeks ago #333370 by activha
Replied by activha on topic CB login authentication token
It was strange so I checked the DB which correctly recorded the value each time the autoaction is fired
It seems it's only the display that does not show the value of the field (both on frontend and on backend). Very strange because I don't have any conditions on the field.
I tried with a brand new one called cb_token_api and it works, so all fine :-)
The following user(s) said Thank You: krileon

Please Log in to join the conversation.

11 months 3 weeks ago - 11 months 3 weeks ago #333378 by activha
Replied by activha on topic CB login authentication token
Oupss seems I spoke too quickly, it's fine to encrypt and store the API token with the code, but the autoaction to decrypt always return null for the variable $userid.

The encrypt autoaction code is :
global $_CB_framework;
$user->set( 'cb_token_api', ( new \Joomla\CMS\Encrypt\Aes( $_CB_framework->getCfg( 'secret' ) . ':[cb_token]' ) )->encryptString( (string) \CBLib\Application\Application::MyUser()->getUserId() ) );
$user->store();

And the decrypt autoaction code is :  
global $_CB_framework;
return (int) ( new \Joomla\CMS\Encrypt\Aes( $_CB_framework->getCfg( 'secret' ) . ':[cb_token]' ) )->decryptString( '[get_token]' );

I properly set code instead of query to retrieve the user in the second autoaction and removed format function

The url is correct : website/?token=cb_token_api

Any idea of what I could have missed ?

EDIT:
I tried also 
return (int) ( new \Joomla\CMS\Encrypt\Aes( $_CB_framework->getCfg( 'secret' ) . ':[cb_token]' ) )->decryptString( '[cb:parse function="clean" method="string"][get_token][/cb:parse]' );
but it's still gives null also

Please Log in to join the conversation.

11 months 3 weeks ago #333381 by krileon
Replied by krileon on topic CB login authentication token
I don't know why you're substituting in [cb_token]. The key isn't meant to change. It's meant to only be known to you so you can encrypt and decrypt reliably. Using a substitution means when you go to decrypt and the user isn't logged in it will always fail. See my example again in my previous reply below.

www.joomlapolis.com/forum/developer-members-support/245731-cb-login-authentication-token?start=0#333331


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.
The following user(s) said Thank You: activha

Please Log in to join the conversation.

11 months 3 weeks ago #333382 by activha
Replied by activha on topic CB login authentication token
Ahhh did not think to this !!
Thanks a lot

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.223 seconds

Facebook Twitter LinkedIn