Here is the dumb question of the day…
Using Slim V4… Where and how should I put a piece of code that can be called from anywhere… In my case I should be able to create a JWT token…
If you for some reason I can’t imagine really, really want to allow anything, anywhere in your application to run a piece of code, put it in $GLOBALS, see https://www.php.net/manual/en/reserved.variables.globals.php. This is a bad idea and you should not do it.
Hi,
Thanks for the reply.
I am already successfully using JWT authentication.
My issue here is to add a custom string to the payload and be able to call the JWT generation code from any Action in the framework.
I just can’t figure out where to put that piece of code that would get my custom string as input and would get the JWT string back as output.
Been struggling with “containers”, “Middleware” and stuff for the last few days and I understand that the solution is pretty straightforward.
Could someone help?