Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

secondman's avatar

Accessing the User Session in a Job

Hey All.

I have a system of external applications (API's) that my users can access through a token/authorization system I built into the app.

Now they need to go the actual list of apps and connect manually. I've set up a login column in my table so that they can choose to connect on login per application, for the ones they use the most.

Currently when they connect, there is a handshake process that eventually returns a token from the external service that gets stored in their session.

When building the autoconnect on login Job, I've discovered that the session isn't able to be accessed as you normally would since the job runs independently.

I do have my user stored on the job class, how can I access that user's session from within a job?

I can add code if needed, but I think this is a pretty straight forward question.

0 likes
1 reply
D9705996's avatar

Can you not store the token somewhere other than the session when it is returned from the external service , maybe on your user model. It would then be accessible to/from the job and if needed can be pushed to the session out with the job?

Please or to participate in this conversation.