Get Referer after login

fabrice.dhuicque
fabrice.dhuicque Spryker Solution Partner Posts: 18 🧑🏻‍🚀 - Cadet

Hello,

Currently on our app, we are redirected on a defined page (for the example let's say /landing-page ) after login, whatever the link (for example /whatever-category/random-product ) which brought us on the website.

So if someone wants to share a link "www.mywonderfulplatform.com/whatever-category/random-product".

I click on the link, I have to login, and after that I'm on "www.mywonderfulplatform.com/landing-page".

I've tried to setup a plugin, added to CustomerPageDependencyProvider::getAfterLoginCustomerRedirectPlugins(), but this need to have a CustomerTransfer parameter, what I can't have as I'm not logged in yet.

I've tried to setup an event listener and play with the session, but nobody talks to my listener (I've added it to KernelEvents::REQUEST, but it's never called).

If any of you already did smthg like this, it could be very helpful to share how you did that :)

Thank you in advance !

Answers

  • Fred Jung
    Fred Jung Spryker Customer Posts: 24 ✨ - Novice

    You could add some logic in your AuthController to catch referer Url and do the trick by extending the

    SprykerRedirectUriCustomerRedirectStrategyPlugin

  • fabrice.dhuicque
    fabrice.dhuicque Spryker Solution Partner Posts: 18 🧑🏻‍🚀 - Cadet

    Hello, thank you for that, but in fact I found what was wrong: my SecurityTwigPlugin prevented me to get the referer (it was edited some time ago in the project).