I run a video application in which videos are embedded through an iframe. If a video is private, sign in is needed, and I currently redirect them to the sign-in page on my domain and then back to the video once complete.
I want users to be able to log in from an embedded iframe and to have their session remain active, without having to navigate to another page.
I have AJAX sign in working from the sign-in page on my domain. However, when try to do this from the iframe, authentication succeeds, but the session is not maintained and rails believes there is no current user upon reload.
My configuration allows iframes to be used anywhere:
config.action_dispatch.default_headers = {
'X-Frame-Options' => 'ALLOWALL'
}
And I do not require an authenticity token for the sign in action.
How can I create and maintain a session from within an iframe?
Edit: The session saves in Firefox, but Chrome, Safari, and Brave don't maintain it. Not sure why this is.