iFrame Auth Reloads Continuously

I wrote a custom iFrame Auth integration to our CRM. It appears to work, but once you login Rocket Chat continues to reload continuously. Below is the flow:

  1. Load Rocket Chat
  2. Rocket Chat calls my SSO REST endpoint which returns 401 since they are not logged in.
  3. Rocket Chat redirects to the login page
  4. User logins in then redirects back to the SSO REST endpoint. The user is now logged in and the endpoint returns the loginToken

At this point Rocket Chat is logged in but it appears to reload itself. It then will continue to reload itself every few minutes. If you load a new tab it starts reloading constantly.

Here is animated gif of the behavior: