Which HTTP method should Login and Logout Actions use in a “RESTful” setup

前端 未结 2 518
被撕碎了的回忆
被撕碎了的回忆 2021-01-03 17:52

Curious how others here would represent these in a REST architecture.

/users/login/
/users/logout/

These endpoints set up the session to lo

相关标签:
2条回答
  • 2021-01-03 18:23

    maybe CONNECT? MDN says:

    The HTTP CONNECT method starts two-way communications with the requested resource. It can be used to open a tunnel.

    as login means maintaining a session between browser and server, CONNECT method makes the most sense.

    0 讨论(0)
  • 2021-01-03 18:38

    You should use POST - using GET for these actions can lead to issues with browser prefetching and search engine spidering. See (1, 2)

    0 讨论(0)
提交回复
热议问题