CB login authentication token

1 year 4 days ago #333523 by activha
Replied by activha on topic CB login authentication token
I think I'll leave it like this as it works fine for external domains and duplicate the autoaction for our own one.

If I use the trigger joomla_onRenderModule, can you tell me what are the variables used ?
Can I simply use a condition with value itemId = MODULE_ID ?

Please Log in to join the conversation.

1 year 3 days ago #333527 by krileon
Replied by krileon on topic CB login authentication token

If I use the trigger joomla_onRenderModule, can you tell me what are the variables used ?

That's a Joomla trigger so you'll need to check Joomla's documentation.

docs.joomla.org/Plugin/Events/Module


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.

Please Log in to join the conversation.

11 months 3 weeks ago #333649 by activha
Replied by activha on topic CB login authentication token
I have a final issue with [get_token] on the code.

When the token has some characters like + for instance, it seems like the code transforms it to %2B or %20 and then the user recognition fails.

Can I use one of your parse function to preserve the token as it is and send it correctly to decryptstring ? which one would suit ?
global $_CB_framework;
$decryptedValue = (int) (new \Joomla\CMS\Encrypt\Aes($_CB_framework->getCfg('secret') . ':a2xdt7zx'))->decryptString('[get_token]');

if ($decryptedValue === null || $decryptedValue === 0) {
    return 1444;
} else {
    return $decryptedValue;
}

Please Log in to join the conversation.

11 months 3 weeks ago #333650 by krileon
Replied by krileon on topic CB login authentication token
The encoded string is not URL safe so you'll have to deal with encoding and decoding it properly or implement replacement behavior in the token to deal with those characters and make it URL safe. My usage in CB Activity 6.0 for example replaces invalid characters. Specifically it applies the below.

Encrypt
rtrim( strtr( $encryptedValue, '+/', '-_' ), '=' );

Decrypt
strtr( '[get_token]', '-_', '+/' );


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.

Please Log in to join the conversation.

11 months 3 weeks ago #333652 by activha
Replied by activha on topic CB login authentication token
you mean something like this will work ?
Encrypt token :
global $_CB_framework;
$encryptedValue = new \Joomla\CMS\Encrypt\Aes( $_CB_framework->getCfg( 'secret' ) . ':a2xdt7zx' ) )->encryptString( (string) \CBLib\Application\Application::MyUser()->getUserId();
$token = rtrim( strtr( $encryptedValue, '+/', '-_' ), '=' );
$user->set( 'cb_token_api', ( $token ) );
$user->store();

Decrypt user :
global $_CB_framework;
$token = strtr( '[get_token]', '-_', '+/' );
$decryptedValue = (int) (new \Joomla\CMS\Encrypt\Aes($_CB_framework->getCfg('secret') . ':a2xdt7zx'))->decryptString($token);

if ($decryptedValue === null || $decryptedValue === 0) {
    return 1444;
} else {
    return $decryptedValue;
}

Please Log in to join the conversation.

11 months 3 weeks ago #333653 by krileon
Replied by krileon on topic CB login authentication token
Yeah, that's basically what I'm doing to make encrypted assets URL safe.


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.

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.236 seconds

Facebook Twitter LinkedIn