简体   繁体   English

REST API-身份验证与授权?

[英]REST API - Authentication vs Authorisation?

I am creating some APIs and I am confused about how my application will authenticate, basically because I feel I need 2 authentications and I cannot find any information about this. 我正在创建一些API,我对我的应用程序将如何进行身份验证感到困惑,基本上是因为我觉得我需要2个身份验证,而我找不到与此有关的任何信息。

  1. Authentication with the API Server (so my app will be able to retrieve data and sync even if no user is logged in) 使用API​​服务器进行身份验证(因此,即使没有用户登录,我的应用程序也可以检索数据并进行同步)
  2. Users authentication 用户认证

Is one endpoint (ie /login ) enough to manage all this? 一个端点(即/ login)足以管理所有这些吗?

Any ideas? 有任何想法吗?

Thank you! 谢谢!

In this case, use an HMAC on the incoming request with a preshared key to authenticate the user. 在这种情况下,请对传入请求使用HMAC和预共享密钥来对用户进行身份验证。 Then on your resource (in the Controller), validate that your user is authorized to access the route. 然后在您的资源上(在Controller中),确认您的用户有权访问该路由。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM