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

reza305's avatar

Flash session data in stateful sanctum

Hi everyone... my question is simple.

Can I use flash session data when I'm working with stateful endpoints in sanctum?

For example, user enters his phone number in the first request. in order to verify it, I want to keep his phone number in the session, just for the next request.

Actually, I have tested this in postman and it was not available in the next request. I'm afraid I may have done something wrong.

As an example, here is my controller method:

    public function login(LoginRequest $request)
    {
        $data = $request->validated();

        try {
            event(new WantToLogin($data['mobile']));
        } catch (Throwable $th) {
            // return some error
        }
        $request->session()->flash('mobile', $data['mobile']);
        return response()->json([
			'message' => 'a token has been sent to your mobile phone'
		]);
    }
0 likes
4 replies
reza305's avatar

@drewdan Actually I stored it in the session and it worked But I need to save it just for the next request and so I used flash session... But it did not worked in postman

drewdan's avatar

I am not sure how postman works in regard to sessions? Could it be that every time you make a postman request, it is making a new session?

Please or to participate in this conversation.