How to design a RESTful API to check for user's credentials?

后端 未结 5 2036
梦谈多话
梦谈多话 2021-02-13 12:31

I\'m designing an API for a mobile app, and I hope to keep it RESTful.
API\'s are authorized using Basic HTTP Auth, however, When the user open the app for the first time, h

5条回答
  •  执笔经年
    2021-02-13 13:17

    From wikipedia:

    The client–server communication is further constrained by no client context being stored on the server between requests. Each request from any client contains all of the information necessary to service the request, and any session state is held in the client.

    Because the server stores no session state from the client, your API shouldn't expose any login/logout capability: In each request you should send user credentials, and the server should validate them each time.

    Check this discussion in SO, it claryfies this concept.

提交回复
热议问题