-
-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Session data getting lost on using TokenRedirect #82
Comments
@Kyon147 can you confirm this bug, if possible? |
A quick google search has return this https://laravel.com/docs/master/session#flash-data Has your tried this method? To see if it works as an alternative? |
No this doesn't. Also, I tried on a non shopify route with normal redirect and it works fine as expected. Session data is retained on that. |
Can you send me what you did that worked? |
I mean if you just do this:
On wiritng the logic of
You would see it would work as expected, the session would be retained. |
@talkwithdeveloper I can confirm using the token redirect, the session is lost. I had a quick look at the cause but could not narrow anything down at the moment. I won't have a lot of time for the next week - so if you can help debug this issue it would be helpful. If you find a solution, open a PR and I'll take a look. |
Sure I would try my best to narrow it ASAP. |
how to send data from post method using tokenRoute in laravel, |
Session data is being lost at the moment, as this ticket is still unresolved. Feel free to open a PR with a solution if you find one. |
Hi any updates on this one? |
@talkwithdeveloper it's not been looked at by myself in much detail yet. It's on my long list of things and being an issue on blade templates I don't actively see it because I mainly use this package as an SPA. When I did take out an hour to look at it, I can confirm the session was lost but I followed through using xDebug and couldn't pin point the issue at the time. I'm hoping someone else can take a deeper look, preferably someone who uses blade like yourself and open a PR, otherwise it will just have to wait until I get to it on my to-do list. |
It's still a pretty relevant issue... its solution would help a lot |
?
Чт, 18 мая 2023 г. в 15:39, Kashif Mushtaq ***@***.***>:
… please close this package not stable
—
Reply to this email directly, view it on GitHub
<#82 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A7DL5C5266VVOLSHD3NJJJTXGYJ73ANCNFSM6AAAAAAUP7KMFI>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
@kashif-sol This package is stable, enough for me to be able to run three Shopify apps successfully using it. I am however only one coding human, so I can't fix all bugs as soon as they come up and try to prioritise the urgent ones that would effect an app from loading. Any package is going to have bugs, like all software on the internet. You are free to use Shopify's packages if you wish, that choice is yours and yours alone. Please refrain from unnecessary spam comments like "close the package" etc as it is just not constructive or helpful. Hope you have a good day and happy coding. |
@Kyon147 I don't have a solution to this issue, but I think I understand at least part of what might be happening. When we're running an embedded app in the Shopify admin, Shopify essentially forces us to hand over management of the user login session to the Shopify admin. So on every request, the VerifyShopify class checks with Shopify to make sure the user is still logged in on the Shopify side. However, on the Laravel side, we get a new Laravel session every pageload, because there's nothing that ties the Shopify session token to the Laravel session ID. I'm using the I was able to verify that I am getting a brand new Laravel session every pageload by logging So it seems that the missing piece here is some sort of lookup table to tie together the Shopify session to the Laravel session, so we can reuse the same Laravel session based on the Shopify session. The other tricky bit is probably that Shopify's session tokens have a lifetime of only one minute. I do see that It's totally possible that there's user error on my part somewhere, but if so I hope documenting what I'm seeing here might help someone else out. |
Hey @michaellehmkuhl That's some good investigation, and really useful. Yeah the session is coming off the back of the JWT token authentication which lasts one minute as you say. I'll have a think about how we could potentially keep session data for longer - it could be refactoring the way Appreciate you taking the time to delve into this a bit more. |
But I tried to find on how the |
@SachinBahukhandi So normal redirects keep session, but the tokenRedirect is not? |
Strange but true. |
I used this package to generate the backtrace: |
In my case, I'm not able to persist a Laravel session at all. Each request initiates a new Laravel session (using v18.0.1, by the way). |
I'll spend a little bit of time this weekend looking into it, thanks for all your research and notes. |
Any updates on this one? If someone could help with the development I would do the rest of the things! Much appreciate the help in advance! |
Any updates on this? I am also unable to get the session values which i stored. I have also removed verify.shopify middleware to test. |
I'm still investigating this at the moment but not had a lot of time to really dive into it. In terms of your issue @CodaemonHaroon you have to use the Redirect wise I am not sure what your issue is but check you are passing the |
Closing this now as multiple tests are working for me, but can re-open if the issue comes back. |
@Kyon147, hello i have installed latest version of the package for this, created a fresh setup. the App is installed successfully. use Illuminate\Support\Facades\Session; I have made the changes in config/session.php file as you said. |
@CodaemonHaroon as it is a cookie / browser issue and not a package issue there might be other things with your set up or code or even the browser that might require changing or additional updates. I've confirmed myself that it's not a package issue and provided the most likely steps to resolve the issue. If you need specific help, outside it being an issue with the package which I know believe it is not as I can get it working. Can you provide more information on your set up in our Discord. Someone or myself can then look at it when free to do so. Update: You have to make sure that the session cookie is staying the same. If it changes then for some reason the app is unable to set the cookie and a new session is created each time in Laravel. Also, is this a local app, is it on a server. Are you on http or HTTPS? There's a lot of variables to consider. |
@Kyon147 Hello, can you please help/provide me the code for how to set the Session and use across my all blades files while redirecting. |
@CodaemonHaroon have you check this PR which another user has fixed the issue #133 Try adding the code from the PR mentioned to pass along the host, then sort out the cookies for the app and see if that solves the issue. The PR for the host in @sessionToken will be deployed this week properly. |
For bug reporting only! If you're posting a feature request or discussion, please ignore.
Expected Behavior
The session data should be retained.
Please describe the behavior you are expecting.
I am using a tokenRedirect inside a controller. I am using a non-SPA.
I have set session before it.
Post token redirect I am unable to retreive the added values from session as it does not exist.
Current Behavior
As mentioned above.
Steps to Reproduce
Please provide detailed steps for reproducing the issue.
Context
Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.
Failure Logs
Please include any relevant log snippets or files here.
The text was updated successfully, but these errors were encountered: