0

I have an application with federated authentication into Linkedin this application have two parts CM/CD

login from CM it works without any issue login from CD gives

10932 14:45:16 ERROR Unable to get and an external login info via Microsoft.Owin.Security.AuthenticationManagerExtensions.GetExternalLoginInfoAsync. Most probably the identity does not have a 'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier' claim.

Sitecore version :: 9.1.0 (rev. 001564)

I noticed that there's a bit difference of configurations between the two servers

Here's the CD configuration

<settings>
  <setting name="FederatedAuthentication.Enabled">
    <patch:attribute name="value">true</patch:attribute>
  </setting>

  <setting name="SiteRootPath" value="/sitecore/content/roo-path" />
  <setting name="MyAPP.Feature.Account.LoginGoalId" value="{66722F52-2D13-4DCC-90FC-EA7117CF2298}" />
  <setting name="MyAPP.Account.RegisterGoalId" value="{8FFB183B-DA1A-4C74-8F3A-9729E9FCFF6A}" />
  <setting name="MyAPP.Feature.Account.LinkedIn.ClientId" value="value" />
  <setting name="MyAPP.Feature.Account.LinkedIn.ClientSecret" value="value" />
  <setting name="MyAPP.Feature.Account.UserReviewAPI" value="https://cm/myapi/AccountAPI/UserReviewAPI" />
  <setting name="MyAPP.Feature.Account.PersonalProfile" value="https://cm/myapi/AccountAPI/PersonalProfile" />
  <setting name="MyAPP.Feature.Account.UploadPersonalImageToServer" value="https://cm/myapi/AccountAPI/UploadPersonalImageToServer" />
</settings>
<pipelines>
  <initialize>
    <processor type="MyAPP.Feature.Account.Pipelines.Initialize.RegisterApiRoutes, MyAPP.Feature.Account"
               patch:before="processor[@type='Sitecore.Mvc.Pipelines.Loader.InitializeControllerFactory, Sitecore.Mvc']" />
  </initialize>
  <accounts.loggedIn>
    <processor type="MyAPP.Feature.Account.Infrastructure.TrackLoggedIn, MyAPP.Feature.Account" resolve="true"/>
  </accounts.loggedIn>
  <accounts.loggedOut>
    <processor type="MyAPP.Feature.Account.Infrastructure.TrackLoggedOut, MyAPP.Feature.Account" resolve="true"/>
  </accounts.loggedOut>
  <accounts.registered>
    <processor type="MyAPP.Feature.Account.Infrastructure.TrackRegistered,MyAPP.Feature.Account" resolve="true"/>
  </accounts.registered>
  <owin.identityProviders>
    <processor type="MyAPP.Feature.Account.Pipelines.IdentityProviders.LinkedIn,MyAPP.Feature.Account" resolve="true" />
  </owin.identityProviders>
  <owin.cookieAuthentication.signedIn>
    <processor type="MyAPP.Feature.Account.Infrastructure.SignedIn.TrackSignedIn, MyAPP.Feature.Account" resolve="true" />
  </owin.cookieAuthentication.signedIn>
</pipelines>
<services>
  <register serviceType="Sitecore.Abstractions.BaseAuthenticationManager, Sitecore.Kernel"
            implementationType="Sitecore.Owin.Authentication.Security.AuthenticationManager, Sitecore.Owin.Authentication"
            lifetime="Singleton" />
  <register serviceType="Sitecore.Abstractions.BaseTicketManager, Sitecore.Kernel"
            implementationType="Sitecore.Owin.Authentication.Security.TicketManager, Sitecore.Owin.Authentication"
            lifetime="Singleton" />
  <register serviceType="Sitecore.Abstractions.BasePreviewManager, Sitecore.Kernel"
            implementationType="Sitecore.Owin.Authentication.Publishing.PreviewManager, Sitecore.Owin.Authentication"
            lifetime="Singleton" />
  <configurator type="MyAPP.Feature.Account.ServiceRegistration, MyAPP.Feature.Account" />
</services>


<federatedAuthentication type="Sitecore.Owin.Authentication.Configuration.FederatedAuthenticationConfiguration, Sitecore.Owin.Authentication">
  <!--Provider mappings to sites-->
  <identityProvidersPerSites hint="list:AddIdentityProvidersPerSites">
  </identityProvidersPerSites>

  <!--Definitions of providers-->
  <identityProviders hint="list:AddIdentityProvider">
    <!--Facebook provider-->
    <identityProvider id="LinkedIn" type="Sitecore.Owin.Authentication.Configuration.DefaultIdentityProvider, Sitecore.Owin.Authentication">
      <param desc="name">LinkedIn</param>
      <param desc="domainManager" type="Sitecore.Abstractions.BaseDomainManager" resolve="true" />
      <caption>LinkedIn</caption>
      <domain>linkedin</domain>
      <transformations hint="list:AddTransformation">

      </transformations>
    </identityProvider>
  </identityProviders>

  <!--List of all shared transformations-->
  <sharedTransformations>
  </sharedTransformations>

  <!--Property mappings initializer-->
  <propertyInitializer type="Sitecore.Owin.Authentication.Services.PropertyInitializer, Sitecore.Owin.Authentication">
    <!--List of property mappings
            Note that all mappings from the list will be applied to each providers-->
    <maps hint="list">
      <!--The mapping sets the Email property of the user profile from emailaddress claim-->
      <map name="Email" type="Sitecore.Owin.Authentication.Services.DefaultClaimToPropertyMapper, Sitecore.Owin.Authentication" resolve="true">
        <data hint="raw:AddData">
          <!--claim name-->
          <source name="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress" />
          <!--property name-->
          <target name="Email" />
        </data>
      </map>
      <map name="full_name" type="Sitecore.Owin.Authentication.Services.DefaultClaimToPropertyMapper, Sitecore.Owin.Authentication" resolve="true">
        <data hint="raw:AddData">
          <source name="urn:linkedin:name" />
          <target name="FullName" />
        </data>
      </map>
      <map name="name" type="Sitecore.Owin.Authentication.Services.DefaultClaimToPropertyMapper, Sitecore.Owin.Authentication" resolve="true">
        <data hint="raw:AddData">
          <source name="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname" />
          <target name="name" />
        </data>
      </map>
      <map name="last_name" type="Sitecore.Owin.Authentication.Services.DefaultClaimToPropertyMapper, Sitecore.Owin.Authentication" resolve="true">
        <data hint="raw:AddData">
          <source name="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname" />
          <target name="LastName" />
        </data>
      </map>
      <map name="first-name" type="Sitecore.Owin.Authentication.Services.DefaultClaimToPropertyMapper, Sitecore.Owin.Authentication" resolve="true">
        <data hint="raw:AddData">
          <source name="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname" />
          <target name="FirstName" />
        </data>
      </map>
      <map name="gender" type="Sitecore.Owin.Authentication.Services.DefaultClaimToPropertyMapper, Sitecore.Owin.Authentication" resolve="true">
        <data hint="raw:AddData">
          <source name="gender" />
          <target name="Gender" />
        </data>
      </map>
      <map name="birthday" type="Sitecore.Owin.Authentication.Services.DefaultClaimToPropertyMapper, Sitecore.Owin.Authentication" resolve="true">
        <data hint="raw:AddData">
          <source name="birthday" />
          <target name="Birthday" />
        </data>
      </map>
      <map name="link" type="Sitecore.Owin.Authentication.Services.DefaultClaimToPropertyMapper, Sitecore.Owin.Authentication" resolve="true">
        <data hint="raw:AddData">
          <source name="link" />
          <target name="Link" />
        </data>
      </map>
      <map name="timezone" type="Sitecore.Owin.Authentication.Services.DefaultClaimToPropertyMapper, Sitecore.Owin.Authentication" resolve="true">
        <data hint="raw:AddData">
          <source name="timezone" />
          <target name="Timezone" />
        </data>
      </map>
      <map name="location" type="Sitecore.Owin.Authentication.Services.DefaultClaimToPropertyMapper, Sitecore.Owin.Authentication" resolve="true">
        <data hint="raw:AddData">
          <source name="location" />
          <target name="Location" />
        </data>
      </map>
      <map name="locale" type="Sitecore.Owin.Authentication.Services.DefaultClaimToPropertyMapper, Sitecore.Owin.Authentication" resolve="true">
        <data hint="raw:AddData">
          <source name="locale" />
          <target name="Language" />
        </data>
      </map>
      <map name="profilePicture" type="Sitecore.Owin.Authentication.Services.DefaultClaimToPropertyMapper, Sitecore.Owin.Authentication" resolve="true">
        <data hint="raw:AddData">
          <source name="profilePicture" />
          <target name="profilePicture" />
        </data>
      </map>
      <!--  <map name="picture_url" type="Sitecore.Owin.Authentication.Services.DefaultClaimToPropertyMapper, Sitecore.Owin.Authentication" resolve="true">
        <data hint="raw:AddData">
          <source name="picture_url" />
          <target name="PictureUrl" />
        </data>
      </map>-->
      <map name="picture_url to Portrait" type="Sitecore.Owin.Authentication.Services.DefaultClaimToPropertyMapper, Sitecore.Owin.Authentication" resolve="true">
        <data hint="raw:AddData">
          <source name="picture_url" />
          <target name="Portrait" />
        </data>
      </map>
      <map name="picture_mime" type="Sitecore.Owin.Authentication.Services.DefaultClaimToPropertyMapper, Sitecore.Owin.Authentication" resolve="true">
        <data hint="raw:AddData">
          <source name="picture_mime" />
          <target name="PictureMimeType" />
        </data>
      </map>
    </maps>
  </propertyInitializer>

</federatedAuthentication>

Here's the CM configuration

<settings>
  <setting name="FederatedAuthentication.Enabled">
    <patch:attribute name="value">true</patch:attribute>
  </setting>

  <setting name="SiteRootPath" value="/sitecore/content/root-path" />
  <setting name="MyAPP.Feature.Account.LoginGoalId" value="{66722F52-2D13-4DCC-90FC-EA7117CF2298}" />
  <setting name="MyAPP.Feature.Account.RegisterGoalId" value="{8FFB183B-DA1A-4C74-8F3A-9729E9FCFF6A}" />
  <setting name="MyAPP.Feature.Account.LinkedIn.ClientId" value="value" />
  <setting name="MyAPP.Feature.Account.LinkedIn.ClientSecret" value="value" />
  <setting name="MyAPP.Feature.Account.UserReviewAPI" value="https://cm/myapi/AccountAPI/UserReviewAPI" />
  <setting name="MyAPP.Feature.Account.PersonalProfile" value="https://cm/myapi/AccountAPI/PersonalProfile" />
  <setting name="MyAPP.Feature.Account.UploadPersonalImageToServer" value="https://cm/myapi/AccountAPI/UploadPersonalImageToServer" />
</settings>
<pipelines>
  <initialize>
    <processor type="MyAPP.Feature.Account.Pipelines.Initialize.RegisterApiRoutes, MyAPP.Feature.Account"
               patch:before="processor[@type='Sitecore.Mvc.Pipelines.Loader.InitializeRoutes, Sitecore.Mvc']" />
  </initialize>

  <accounts.loggedIn>
    <processor type="MyAPP.Feature.Account.Infrastructure.TrackLoggedIn, MyAPP.Feature.Account" resolve="true"/>
  </accounts.loggedIn>
  <accounts.loggedOut>
    <processor type="MyAPP.Feature.Account.Infrastructure.TrackLoggedOut, MyAPP.Feature.Account" resolve="true"/>
  </accounts.loggedOut>
  <accounts.registered>
    <processor type="MyAPP.Feature.Account.Infrastructure.TrackRegistered,MyAPP.Feature.Account" resolve="true"/>
  </accounts.registered>
  <owin.identityProviders>
    <processor type="MyAPP.Feature.Account.Pipelines.IdentityProviders.LinkedIn,MyAPP.Feature.Account" resolve="true" />
  </owin.identityProviders>
  <owin.cookieAuthentication.signedIn>
    <processor type="MyAPP.Feature.Account.Infrastructure.SignedIn.TrackSignedIn, MyAPP.Feature.Account" resolve="true" />
  </owin.cookieAuthentication.signedIn>
</pipelines>
<services>
  <register serviceType="Sitecore.Abstractions.BaseAuthenticationManager, Sitecore.Kernel"
            implementationType="Sitecore.Owin.Authentication.Security.AuthenticationManager, Sitecore.Owin.Authentication"
            lifetime="Singleton" />
  <register serviceType="Sitecore.Abstractions.BaseTicketManager, Sitecore.Kernel"
            implementationType="Sitecore.Owin.Authentication.Security.TicketManager, Sitecore.Owin.Authentication"
            lifetime="Singleton" />
  <register serviceType="Sitecore.Abstractions.BasePreviewManager, Sitecore.Kernel"
            implementationType="Sitecore.Owin.Authentication.Publishing.PreviewManager, Sitecore.Owin.Authentication"
            lifetime="Singleton" />
  <configurator type="MyAPP.Feature.Account.ServiceRegistration, MyAPP.Feature.Account" />
</services>


<federatedAuthentication type="Sitecore.Owin.Authentication.Configuration.FederatedAuthenticationConfiguration, Sitecore.Owin.Authentication">
  <!--Provider mappings to sites-->
  <identityProvidersPerSites hint="list:AddIdentityProvidersPerSites">
  </identityProvidersPerSites>

  <!--Definitions of providers-->
  <identityProviders hint="list:AddIdentityProvider">
    <!--Facebook provider-->
    <identityProvider id="LinkedIn" type="Sitecore.Owin.Authentication.Configuration.DefaultIdentityProvider, Sitecore.Owin.Authentication">
      <param desc="name">LinkedIn</param>
      <param desc="domainManager" type="Sitecore.Abstractions.BaseDomainManager" resolve="true" />
      <caption>LinkedIn</caption>
      <domain>linkedin</domain>
      <transformations hint="list:AddTransformation">

      </transformations>
    </identityProvider>
  </identityProviders>

  <!--List of all shared transformations-->
  <sharedTransformations>
  </sharedTransformations>

  <!--Property mappings initializer-->
  <propertyInitializer type="Sitecore.Owin.Authentication.Services.PropertyInitializer, Sitecore.Owin.Authentication">
    <!--List of property mappings
            Note that all mappings from the list will be applied to each providers-->
    <maps hint="list">
      <!--The mapping sets the Email property of the user profile from emailaddress claim-->
      <map name="Email" type="Sitecore.Owin.Authentication.Services.DefaultClaimToPropertyMapper, Sitecore.Owin.Authentication" resolve="true">
        <data hint="raw:AddData">
          <!--claim name-->
          <source name="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress" />
          <!--property name-->
          <target name="Email" />
        </data>
      </map>
      <map name="full_name" type="Sitecore.Owin.Authentication.Services.DefaultClaimToPropertyMapper, Sitecore.Owin.Authentication" resolve="true">
        <data hint="raw:AddData">
          <source name="urn:linkedin:name" />
          <target name="FullName" />
        </data>
      </map>
      <map name="name" type="Sitecore.Owin.Authentication.Services.DefaultClaimToPropertyMapper, Sitecore.Owin.Authentication" resolve="true">
        <data hint="raw:AddData">
          <source name="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname" />
          <target name="name" />
        </data>
      </map>
      <map name="last_name" type="Sitecore.Owin.Authentication.Services.DefaultClaimToPropertyMapper, Sitecore.Owin.Authentication" resolve="true">
        <data hint="raw:AddData">
          <source name="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname" />
          <target name="LastName" />
        </data>
      </map>
      <map name="first-name" type="Sitecore.Owin.Authentication.Services.DefaultClaimToPropertyMapper, Sitecore.Owin.Authentication" resolve="true">
        <data hint="raw:AddData">
          <source name="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname" />
          <target name="FirstName" />
        </data>
      </map>
      <map name="gender" type="Sitecore.Owin.Authentication.Services.DefaultClaimToPropertyMapper, Sitecore.Owin.Authentication" resolve="true">
        <data hint="raw:AddData">
          <source name="gender" />
          <target name="Gender" />
        </data>
      </map>
      <map name="birthday" type="Sitecore.Owin.Authentication.Services.DefaultClaimToPropertyMapper, Sitecore.Owin.Authentication" resolve="true">
        <data hint="raw:AddData">
          <source name="birthday" />
          <target name="Birthday" />
        </data>
      </map>
      <map name="link" type="Sitecore.Owin.Authentication.Services.DefaultClaimToPropertyMapper, Sitecore.Owin.Authentication" resolve="true">
        <data hint="raw:AddData">
          <source name="link" />
          <target name="Link" />
        </data>
      </map>
      <map name="timezone" type="Sitecore.Owin.Authentication.Services.DefaultClaimToPropertyMapper, Sitecore.Owin.Authentication" resolve="true">
        <data hint="raw:AddData">
          <source name="timezone" />
          <target name="Timezone" />
        </data>
      </map>
      <map name="location" type="Sitecore.Owin.Authentication.Services.DefaultClaimToPropertyMapper, Sitecore.Owin.Authentication" resolve="true">
        <data hint="raw:AddData">
          <source name="location" />
          <target name="Location" />
        </data>
      </map>
      <map name="locale" type="Sitecore.Owin.Authentication.Services.DefaultClaimToPropertyMapper, Sitecore.Owin.Authentication" resolve="true">
        <data hint="raw:AddData">
          <source name="locale" />
          <target name="Language" />
        </data>
      </map>
      <map name="profilePicture" type="Sitecore.Owin.Authentication.Services.DefaultClaimToPropertyMapper, Sitecore.Owin.Authentication" resolve="true">
        <data hint="raw:AddData">
          <source name="profilePicture" />
          <target name="profilePicture" />
        </data>
      </map>
      <!--  <map name="picture_url" type="Sitecore.Owin.Authentication.Services.DefaultClaimToPropertyMapper, Sitecore.Owin.Authentication" resolve="true">
        <data hint="raw:AddData">
          <source name="picture_url" />
          <target name="PictureUrl" />
        </data>
      </map>-->
      <map name="picture_url to Portrait" type="Sitecore.Owin.Authentication.Services.DefaultClaimToPropertyMapper, Sitecore.Owin.Authentication" resolve="true">
        <data hint="raw:AddData">
          <source name="picture_url" />
          <target name="Portrait" />
        </data>
      </map>
      <map name="picture_mime" type="Sitecore.Owin.Authentication.Services.DefaultClaimToPropertyMapper, Sitecore.Owin.Authentication" resolve="true">
        <data hint="raw:AddData">
          <source name="picture_mime" />
          <target name="PictureMimeType" />
        </data>
      </map>
    </maps>
  </propertyInitializer>

</federatedAuthentication>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.