This approach may be a bit problematic, but doable. Many of the authentication providers that use OAUTH, for example (Google, Facebook, OpenID), redirect users to the given URL after they log in and authenticate the application. You will need to find a way to return them to the page from which they came (with iframe). I think you can find out where your iframe is located (window.top, window.parent, i.e.) Save this information in SESSION or COOKIE, and then return the user to the page after authentication is complete.
source share