Which of the following statements about api interface verification?

Source: Internet
Author: User
I want to create an api and an api

Reply content:

Create an api

It's easy to write a class or method that can be accessed through a browser and then output and return the corresponding data.JsonFormat

Api Authentication requires two considerations: client requests and requests from other services.

The easiest way to request a client is to control cross-origin access.Access-Control-Allow-Origin.

Currently, the mainstream idea of server verification is to generate a secret for the service that is allowed to access. the other party is required to generate a token according to certain rules. During access, a token is provided for local verification.

The specific token generation rules are designed according to the actual situation. Generally, they are various types of encryption and encoding.

Use token for verification. The procedure is as follows:
1. the client first uses the account and password to log on. a random string is generated after logon, written to the database, and returned to the client.
2. the client uses token to request protected resources
3. the server uses the token to search for the database. if the token is valid, the server continues the request. otherwise, 401 is returned.

The client and server respectively hold the same public key, the same algorithm, and calculate the sign signature. This signature is dynamically calculated and carried each time the API is called. before the server executes the interface, obtain the client parameters and use the public key to calculate the signature. you can compare the signature each time.

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.