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

adamoxy's avatar

laravel api with session

my API is working fine with the requests from an API testing apps aka (postman or insomnia) but when the request comes from a mobile application (flutter app) the request comes empty session. is there any difference or I am missing something here!?

            $phone_session = $request->session()->get('phone', '+000---------');
            return ["phone: ".$phone_session];
0 likes
4 replies
adamoxy's avatar

I didn't ! just working with the framework defaults. if there is a special config enlight me, please. @thetoad01

adamoxy's avatar

but @thetoad01 all my routes are working fine with the postman which is still a client like it like the mobo app !?

martinbean's avatar

is there any difference or I am missing something here!?

@adamoxy The difference is, you don’t use sessions in an API. APIs are stateless and you should be using token-based authentication like OAuth.

Please or to participate in this conversation.