Authentication between mvc and webapi (Separate domains/Applications)

后端 未结 2 2067
别跟我提以往
别跟我提以往 2021-01-31 21:07

im looking for good ideas/resources/implementations for the following scenario

A MVC website at http://mywebsite.com

A Webapi REST service at http://myapi.com

2条回答
  •  清歌不尽
    2021-01-31 21:41

    token solution sounds good.

    Get the authentication token from MVC application, you can send that token with each API request in some custom header. Create an ActionFilterAttribute and in OnActionExecuting you can verify the token and act accordingly.

提交回复
热议问题