First part of fix for web-auth popup support