Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

A REST client usually send an authentication parameter every time which acts like PHP Session Id cookie in browser in a way. But REST client is no browser so I though in my server side code why not I take that authentication parameter and use

session_id($_GET('authentication_code'));

Is it good way of doing it ??

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
506 views
Welcome To Ask or Share your Answers For Others

1 Answer

REST stands for Representation State Transfer and in it's purest form boils down to 6 constraints, one of which is that the client-server communication must be stateless, it must contain all the information needed to complete the request, no client state must be stored on the server.

The server CAN be statefull however, which is why you can store a client's auth code on the server, but it is up to the client itself to pass that code with each request, the server cannot use sessions to store the authentication code.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share

548k questions

547k answers

4 comments

86.3k users

...