I want to implement linkedin login to my application. I use Owin.Security.Providers, Owin.Security.Providers.Linkedin
My Startup.Auth :
app.UseLinkedInAuthentication(new LinkedInAuthenticationOptions()
{
ClientId = "my_client_id",
ClientSecret = "my_client_secret"
});
My Linkedin app :
When i click Login with Linkedin and press "Allow" button
Program comes to these codes.
// GET: /Account/ExternalLoginCallback
[AllowAnonymous]
public async Task<ActionResult> ExternalLoginCallback(string returnUrl)
{
var loginInfo = await AuthenticationManager.GetExternalLoginInfoAsync();
if (loginInfo == null)
{
return RedirectToAction("Login");
}
// Sign in the user with this external login provider if the user already has a login
var result = await SignInManager.ExternalSignInAsync(loginInfo, isPersistent: false);
var user = await UserManager.FindByEmailAsync(loginInfo.Email);
switch (result)
{
case SignInStatus.Success:
return RedirectToStep(user);
case SignInStatus.LockedOut:
return View("Lockout");
case SignInStatus.RequiresVerification:
return RedirectToAction("SendCode", new { ReturnUrl = returnUrl, RememberMe = false });
case SignInStatus.Failure:
default:
// If the user does not have an account, then prompt the user to create an account
ViewBag.ReturnUrl = returnUrl;
ViewBag.LoginProvider = loginInfo.Login.LoginProvider;
//return View("ExternalLoginConfirmation", new ExternalLoginConfirmationViewModel { Email = loginInfo.Email });
return RedirectToAction("ExternalLoginConfirmation", new ExternalLoginConfirmationViewModel { Email = loginInfo.Email });
}
}
But the method i placed below returns null
var loginInfo = await AuthenticationManager.GetExternalLoginInfoAsync();
However same codes works well with Facebook login.
I would like to know what you recommend to me