I am trying to integrate LinkedIn Login into my .Net core 2.0 project using built in authentication template. I am able to redirect control to LinkedIn login User interface, but when I enter Username and Password then I get following error.
An unhandled exception occurred while processing the request.
HttpRequestException: An error occurred while retrieving the user profile.
Microsoft.AspNetCore.Authentication.RemoteAuthenticationHandler+<HandleRequestAsync>d__12.MoveNext()
The following is Startup.cs code for LinkedIn Login Integration:
services.AddAuthentication().AddLinkedIn(options =>
{
options.ClientId = "Client_Id";
options.ClientSecret = "Client_Secret";
});
The following is Error Stack:
Microsoft.AspNetCore.Authentication.RemoteAuthenticationHandler+
<HandleRequestAsync>d__12.MoveNext()
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
Microsoft.AspNetCore.Authentication.AuthenticationMiddleware+
<Invoke>d__6.MoveNext()
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (Задача)
Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.MigrationsEndPointMiddleware + d__4.MoveNext ()
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw ()
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (Задача)
Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.DatabaseErrorPageMiddleware + d__6.MoveNext ()
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw ()
Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.DatabaseErrorPageMiddleware + d__6.MoveNext ()
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw ()
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (Задача)
Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware + d__7.MoveNext ()