sivashanker
sivashanker

Reputation: 99

laravel website session not working in iframe

Below is my laravel website in iframe. By means of token we validate and redirect user to dashboard page.

<iframe src="http://localhost/laravel-web-app/public/logincheck/f0c1bc3c965f5c59946f4bb49c2d7ccd01ab12e1035ea3c96d7dcc59b29e2d7d" style="width:100%; height: 100%;">

But on redirection session data of user is not working. I tried to change config/session.php

'same_site' => 'none' 

but actual laravel website is showing page expired. Can someone help to do session management inside iframe ?

I gone through this url also and it did not work : Laravel 7 session break on IFRAME in a different domain

Upvotes: 6

Views: 7107

Answers (1)

Yuvraj Hinger
Yuvraj Hinger

Reputation: 368

Here is the resolution to make sessions working in iframe. In config/session.php file of your laravel project

'secure' => env('SESSION_SECURE_COOKIE',true),
'same_site' => 'none',

this changes makes your session working in iframe and it also makes that same session to work on outside the iframe.

Upvotes: 13

Related Questions