Page 1 of 1

Open outside app with user_token

Posted: Fri Oct 04, 2019 11:16 pm
by ceebeeit
To be able to return to Opencart from an outside app I need to remember the (user_)token. Otherwise I must login again.
Used to do that in 1.5.5.1 is this way:
app.php?token=<?php echo $token; ?>

This doesn't work in 3.0.3.2. Twig refuses the php code
How should I transfer user_token now in URL?

Re: Open outside app with user_token

Posted: Sat Oct 05, 2019 10:12 pm
by Johnathan
If the $token variable is still set in the controller file, then you'd use this in the .twig template:

{{ token }}

You can read more about Twig syntax here:

https://twig.symfony.com/

Re: Open outside app with user_token

Posted: Sun Oct 06, 2019 1:33 am
by xxvirusxx
Or this:

Code: Select all

app.php?token={{ user_token }}
And you should specify in which file you use app.php?token=<?php echo $token; ?> on 1.5 version...

Re: Open outside app with user_token

Posted: Mon Oct 07, 2019 10:36 pm
by Johnathan
Just to note, OpenCart 3 uses "user_token" instead, so you probably want this:

Code: Select all

user_token={{ user_token }}

Re: Open outside app with user_token

Posted: Tue Oct 08, 2019 11:00 pm
by ceebeeit
Thanks
works fine with {{ user_token }} included in URL.