Permission error when logging in to website using LinkedIn Social Connector


Description

When using the Sitecore Social Connected login functionality on the website, some users may not be able to log in using their LinkedIn account. The following exception may appear in the Sitecore log files:

ERROR Sitecore.Social: LinkedIn exception: The remote server returned an error: (403) Forbidden.
Exception: Sitecore.Social.NetworkProviders.Exceptions.AccessDeniedException
Message: The remote server returned an error: (403) Forbidden.
Source: Sitecore.Social.NetworkProviders
   at Sitecore.Social.NetworkProviders.Exceptions.Analyzers.NetworkExceptionAnalyzer.ThrowExceptionByStatusCode(Exception exception)
   at Sitecore.Social.LinkedIn.Networks.Providers.LinkedInProvider.AuthGetCode(AuthArgs args)
   at Sitecore.Social.Client.Connector.SocialLogin.ProcessRequest(HttpContext httpContext)

Nested Exception

Exception: System.Net.WebException
Message: The remote server returned an error: (403) Forbidden.
Source: System
   at System.Net.HttpWebRequest.GetResponse()
   at LinkedIn.oAuthLinkedIn.WebResponseGet(HttpWebRequest webRequest)
   at LinkedIn.oAuthLinkedIn.WebRequest(Method method, String url, String postData)
   at LinkedIn.oAuthLinkedIn.oAuthWebRequest(Method method, String url, String postData)
   at Sitecore.Social.LinkedIn.Networks.Providers.LinkedInProvider.AuthGetCode(AuthArgs args)

This issue may occur due to a change in the LinkedIn permission configuration mechanism.

Some previously allowed LinkedIn permissions used by Sitecore when retrieving user information now require explicit approval from LinkedIn. This causes some requests from Sitecore to LinkedIn fail with the permission error.

More information about the change can be found here:
https://developer.linkedin.com/support/developer-program-transition

Solution

You can participate in the Apply with LinkedIn or Partner programs in order to get access to the extended user information or disable those Sitecore profile mappings that require extra permissions. This includes permissions such as r_fullprofile, r_contactinfo, r_network.

To change Sitecore profile mappings, use the following files:

More information about LinkedIn user profile fields and required permissions can be found here:
https://developer.linkedin.com/docs/fields