Federated Authentication causes SPEAK requests to fail


Description

Federated Authentication can cause SPEAK requests to fail. When the environment is affected by this issue, the following behavior is observed:

The following error appears in the browser console:

"Uncaught SyntaxError: Unexpected token <" coming from "/Sitecore/login?ReturnUrl=%2f-%2fspeak%2fv1%2fassets%2fmain.js"

Solution

To fix this issue:

<federatedAuthentication type="Sitecore.Owin.Authentication.Configuration.FederatedAuthenticationConfiguration, Sitecore.Owin.Authentication">
  <identityProvidersPerSites hint="list:AddIdentityProvidersPerSites">
    <mapEntry name="adfs" type="Sitecore.Owin.Authentication.Collections.IdentityProvidersPerSitesMapEntry, Sitecore.Owin.Authentication" >
    <sites hint="list">
      <site>shell</site>
      <site>login</site>
      <site>admin</site>
      <site>service</site>
      <site>modules_shell</site>
      <site>modules_website</site>
      <site>custom_website_1</site>
      <site>custom_website_2</site>
      <site>website</site>
      <site>scheduler</site>
      <site>system</site>
      <site>publisher</site>
    </sites>
    ...