API Development First: App Server API development for session

Source: Internet
Author: User

For the first time to do the API development of the app, the first question encountered was: where is my sessionid?

The implementation of a function is: SMS verification function, the general flowchart is as follows:


The problem arises when the client does not bring the SessionID through the header when submitting the verification. At this point, the server does not know which session to take the value from to judge. So the core point of the problem is where is this sessionid? When I used to do PC-side, I never cared about this problem, because the browser helped us to finish it.

Solution One:

First of all, this error is not due to the server error, the server can still be like normal PC development time encoding, of course, here you can also use the session, give SessionID a name, and then send to the client, Each of you maintains this sessionid each other. This is a solution.

Solution Two:

Modify the header of the client request get or POST request. Set the SessionID to a cookie. One of the issues to be aware of here is to ensure that the SessionID is unique when set up, otherwise the server will still not be able to locate the session member.

Note: In my project, only the Android side has this problem, iOS does not appear this SessionID loss situation, iOS Use the framework is afnetworking. I think there must be something inside the framework.


API Development First: App Server API development for session

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.