Create two registry keys:
HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Common\Identity
, create a DWORD item named EnableADAL
and set it to 1.
HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Common\Identity
, create a DWORD item named EnableADAL
and set it to zero.