PHP interface return code and signature verification

Source: Internet
Author: User
Tags http authentication
1. return code. I usually use 0 and 1, and the success is 0. all failures are 1. how do you write them. 2. for interface security, how do you sign a signature. 1. return code. I usually use 0 and 1, and the success is 0. all failures are 1. how do you write them.
2. for interface security, how do you sign a signature.

Reply content:

1. return code. I usually use 0 and 1, and the success is 0. all failures are 1. how do you write them.
2. for interface security, how do you sign a signature.

Available Restful and Oauth

The return code can be segmented according to the business definition, instead of simply 0, 1. this will be clearer.

  1. Return code: We recommend that you consult with the Web front-end/App developers. the request is successful, but there are many reasons for the error. it is more advantageous for debugging to be subdivided, otherwise, you will return a value of 0, and the client will not know whether the request has an error or the server has an error.

  2. Interface Security: try HTTPS encrypted traffic and perform authentication on the request. our backend sends a Token to the client after verifying the user identity, and verifies the user identity with the Token, at the same time, some modifications are made to the native client request Header information, and any non-conforming information will be filtered out.

It helps you to see this:
Http://developer.qiniu.com/ar...

1. signature verification I currently use a combination of oAuth2.0 and Http authentication mechanisms. for details, refer to JWT authentication.
2. the return code, which is usually discussed with the demand side of your interface or you will unilaterally determine a specification for them. I am using an HTTP status code as the return code, each programmer understands the HTTP status code, saving the time required to connect the planning time to this aspect.

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.