This topic is locked
[SOLVED]

 JWT connect to external App

2/4/2021 12:34:49 AM
PHPRunner General questions
A
acpan author

Hi,
I enabled JWT on a PHPRunner App (app1)'s Welcome Page menu and link to another external PHPRunner app (app2).

It works flawlessly and well!
I have one challenge tho', the user table has another field, group_id which must also be passed to the external app2, in order to restrict

certain functions on app2.
I digged into the external.php file, i can simply modify the $url to have extra param, eg. :
$url = $url."?group_id=".$_SESSION["group_id"];
I can get this group_id value, when i echoed $_GET["group_id"] on App2.
But it is not ideal, as it is not safe to show the group_id on the URL, is there a way to use the JWT payload?

----
A suggestion for Sergy's Team to consider: Would be nice to have an extra field that can accept $_SESSION var,

in addition to the current Auth field for linking the external app. This value can be passed to external app using its payload.
Thanks.

Admin 2/4/2021

We are unlikely to use JWT for anything but for authentication.
There are multiple options of how you can make it work. First of all, you can just pull the group_id value from the database, based on username. I assume that the username is unique as it should.
The second option, you can share PHP sessions between these two projects, assuming that both projects reside on the same web server.
And the last one, if both projects use the same database you can pass data between them using some database table which really sounds like an overkill though.

A
acpan author 2/4/2021

Thanks Sergey,I will explore the session option that sounds like a good fit.
In any case, the JWT solution is an amazing and secured solution after I tried out, kudos to your team!