Skip to Content Skip to Menu

🌟Discover the Joomla AI Plugin that wrote its own story! - CB Editor Assistant 1.1now for Joomla 3, 4 & 5!
✍️ 5-Day Free Trial, then 🎯 save up to 30% with our 🛍️ Intro Offer (First 50 users, ends Dec. 31)
🌲 Merry Christmas! Great savings on Professional and Developer Memberships! Get 25% off now with code XMAS-2024!

CB login authentication token

  • activha
  • activha
  • OFFLINE
  • Posts: 2336
  • Thanks: 117
  • Karma: 13
1 year 8 months 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 or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48630
  • Thanks: 8307
  • Karma: 1446
1 year 8 months 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 or Create an account to join the conversation.

  • activha
  • activha
  • OFFLINE
  • Posts: 2336
  • Thanks: 117
  • Karma: 13
1 year 8 months ago - 1 year 8 months 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 :-)
Last edit: 1 year 8 months ago by activha.
The following user(s) said Thank You: krileon

Please Log in or Create an account to join the conversation.

  • activha
  • activha
  • OFFLINE
  • Posts: 2336
  • Thanks: 117
  • Karma: 13
1 year 8 months ago - 1 year 8 months 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 :
Code:
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 :  
Code:
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 
Code:
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
Last edit: 1 year 8 months ago by activha.

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48630
  • Thanks: 8307
  • Karma: 1446
1 year 8 months 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 or Create an account to join the conversation.

  • activha
  • activha
  • OFFLINE
  • Posts: 2336
  • Thanks: 117
  • Karma: 13
1 year 8 months 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 or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum