title: AddOAuth linkedin dotnet core 2.0
body: <p>I'm using dotnet core I want to setup a LinkedIn authentication on the site since there is no default authentication builder for LinkedIn as facebook, google and twitter I decided to use the generic implementation as follows:</p>
  
  <pre><code>services.AddAuthentication().AddOAuth("LinkedIn", 
              c =&gt;
              {
                  c.ClientId = Configuration["linkedin-app-id"];
                  c.ClientSecret = Configuration["linkedin-app-secret"];
                  c.Scope.Add("r_basicprofile");
                  c.Scope.Add("r_emailaddress");
                  c.CallbackPath = "/signin-linkedin";
                  c.AuthorizationEndpoint = "https://www.linkedin.com/oauth/v2/authorization";
                  c.TokenEndpoint = "https://www.linkedin.com/oauth/v2/accessToken";
                  c.UserInformationEndpoint = "https://api.linkedin.com/v1/people/~:(id,formatted-name,email-address,picture-url)";
  })
  </code></pre>
  
  <p>I'm having an issue because GetExternalLoginInfoAsync() is null, looking the Identity ASP.net core source, is because the providerkey is null.</p>
  
  <p>Taken from asp.net core code:</p>
  
  <pre><code>var providerKey = auth.Principal.FindFirstValue(ClaimTypes.NameIdentifier);
  var provider = items["LoginProvider"] as string;
  if (providerKey == null || provider == null)
  {
     return null;
  }
  </code></pre>
  
  <p>the question is where can I add the <strong>ClaimTypes.NameIdentifier</strong> to the LinkedIn claim?</p>