MVC 5, Identity 2.0 Android Rest/Json Api

人盡茶涼 提交于 2019-12-03 19:29:45
Anish Patel

You can, as you suggested, create a Filter for your WebApi controllers to authorize and authenticate access from your client application. Here is a blog post that may help you implement such a thing.

However, I suggest using access tokens as defined by the Oauth standard. This method of authentication and authorization is very well suited for mobile applications. You can create long life access tokens that keep your mobile client app logged in similarly to long life cookies and a browser client. Or you could use short life access tokens and long life refresh tokens. Also there is nothing stopping you from using Oauth with browser clients either, giving you a single auth implementation. Here is a great SO answer on tokens and Oauth.

Have a look at IdentityServer the following blurb is from their Github repository:

IdentityServer is a .NET/Katana-based framework and hostable component that allows implementing single sign-on and access control for modern web applications and APIs using protocols like OpenID Connect and OAuth2. It supports a wide range of clients like mobile, web, SPAs and desktop applications and is extensible to allow integration in new and existing architectures.

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