Use One Identity for WebAPI and Asp.Net Core In different projects

六月ゝ 毕业季﹏ 提交于 2021-01-28 03:25:49

问题


I have a solution that contains 2 dot net core projects :

  1. Web API
  2. Web Application(MVC)

The web application is a web API consumer. My web application controller will use httpclient for getting data and I use razor for the client (no Javascript library such as Angular). I want to use Microsoft identity for authentication and recently I have read about JWT .

In which project should I add Microsoft Identity? (Because we need authentication for building a token in JWT)

If I must add it in the Web API project, how can I use identity when I need authentication in razor-- or somewhere else in the MVC project-- using User.Identity.IsAuthenticated or usermanager?

来源:https://stackoverflow.com/questions/52896967/use-one-identity-for-webapi-and-asp-net-core-in-different-projects

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!