Jump to content

Get the right token


ete

Recommended Posts

I'm trying to develop a new tab where i want a link to a customer. I've peeked inside other admin tabs and the get the token as:

Tools::getAdminToken('AdminCustomers'.intval(Tab::getIdFromClassName('AdminCustomers')).intval($cookie->id_employee))



but when i implement this in my link as per:

$token = Tools::getAdminToken('AdminGroups'.intval(Tab::getIdFromClassName('AdminGroups')).intval($cookie->id_employee));
Client 



It gives me another token, who doesn't work. Is there something need to include in the beginning of the tab to get i working?

Link to comment
Share on other sites

I am not sure what you are trying to achieve exactly but your code snippet uses the method Tools::getAdminToken() which looks like this:

static public function getAdminToken($string)
{
   return !empty($string) ? Tools::encrypt($string) : false;
}



So whatever you pass to that function is just returned encrypted in some manner so garbage in, garbage out. If you are not getting the token you want, you need to look at what the actual value of this concatenation is before you encrypt it:

'AdminGroups'.intval(Tab::getIdFromClassName('AdminGroups')).intval($cookie->id_employee);



Try echoing that string first and that should show you whether the AdminGroups tab ID and employee ID are getting set correctly.

Cheers

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...