Closed yucelakpinar closed 5 years ago
You can't have both, not the way you want. You have to have a way to trigger the login that you want. As you are wanting AAD and identity it becomes weird, AAD expects to be the sole source of user information, you don't double up or duplicate. This isn't a scenario we support with identity.
Hello,
I'm new on asp.net core & asp.net identity, so that couldn't undestand what is happening on my app. I configured individual accounts on my app with adding
services.AddIdentity<IdentityUser, IdentityRole>()
on StartUp file and it works well. On another code branch I also configured Azure AD login with addingservices.AddAuthentication().AddOpenIdConnect()
on StartUp file (in this branch individual account is not added) and it works well too. Then I merge both branches which means that I want to use both authentications on my app, individual accounts still working, but Azure AD login doesn't working.Here is my StartUp file.
Failed Case: After returning back to my web app from authentication on azure website, on /signin-oidc page 'Identity.External' cookie is added to the response, then this page make a 302 redirect to the my return-url, but on my return-url when I check the User.Identity.IsAuthenticated property, its value is False (which was True when individual account not configured on StartUp file)
Steps:
1.Forward client to azure authentication website with following code:
public IActionResult LoginWithOpenId(string returnUrl) { return Challenge("myAzureAD"); }
2.Login on azure website. 3.Return back to callback path(/signin-oidc). 3.Callback page set the required cookies.('Identity.External') 4.Forwarded to return-url by 302 redirect from callback page. 5.Check User.Identity.IsAuthenticated is False.Note:I hope someone can help me, I ask this question to stackoverflow.com but no give any answer :(.
Best Regards