Captcha

Captcha

In terms of interface security control, human-machine verification can play a key protective role, especially in complex network environments, to ensure system security and data integrity. The following method provides how to access human-machine verification in the MultiMarket system:

Verification access

This function is connected to Google's official reCAPTCHA, https://developers.google.com/recaptcha

Involved interfaces

login/customer.app.CustomerWebApiService.login global/message.app.VerificationApiService.verifyCodeSend register/customer.app.CustomerWebApiService.register

headrs: {
    // Add google captcha to request header
    captcha: zxksjkdjskdjsd
}

Access steps

For detailed access documents, see: https://developers.google.com/recaptcha/docs/display

Register Google reCAPTCHA and get the key

  • Register a new website in the management platform http://www.google.com/recaptcha/admin, fill in the form and select the reCAPTCHA version (v2 or v3) suitable for your website

  • After completing the registration, you will get a "Site Key" and a "Secret Key". The site key is used for the front-end, and the secret key is used for back-end verification.

Front-end page integration (V3 version) Official example:

  1. Add the following code to your HTML page, usually in the tag

Replace your_site_key with the site key you obtained in the Admin console.

  1. According to the needs, when the user submits the form (login, registration, get verification code, etc.), call the grecaptcha.execute method to obtain the parameters required for the interface request captcha

  1. Add the request header when requesting the interface and pass it to the backend for verification

  1. Initiate an interface request Pass verification: Request content is returned normally Failed: {"msg":"Illegal request parameters","code":"F999999","bizCode":"G"}

Front-end Vue integration (V3 version) Example:

  1. Download and import vue-recaptcha-v3

  1. Create the useRecaptcha.js file

Last updated