The translation was generated automatically and may contain mistakes

The Interaction Scenario

The article describes the scheme and order of interaction of your web application with VK ID Captcha SDK Web and API VKontakte

How to install and connect VK ID Captcha SDK for web platform, see WEB instructions .

Interaction scheme

Interaction scheme with VK ID Captcha SDK WebInteraction scheme with VK ID Captcha SDK Web

Order of interaction

  1. 1.
    Web App install and connect VK ID Captcha SDK Web.
  2. 2.
    Web App integrates the captcha error handler to the Web API response handler.
  3. 3.
    The API request is VKontakte>
  4. 4.
  5. 5.
    The VKontakte API returns a web application captcha Error with code error_code: 14 , the message error_msg: "Captcha needed" and a reference to initialize the captcha session in the field redirect_uri .
  6. 6.
    The web application sends a request to the VK ID Captcha SDK Web to display the captcha using the method captchaWidget.show() .
  7. 7.
    The Captcha SDK Web VK ID sends a captcha display request to the Captcha iframe.
  8. 8.
    The user passes the captcha.
  9. 9.
    The API VKontakte analyzes user actions. Depending on the result, options are possible:
    • •
      Successful scenario: the user is a person who has passed the captcha.
      1. 1.
        The VKontakte API creates a captcha success token success_token and passes it to the Captcha iframe.
      2. 2.
        Captcha iframe transmits success_token VK ID Captcha SDK Web.
      3. 3.
        Depending on the type of captcha display view , the Captcha iframe does one of the following:
        • •
          Closes the captcha if it is displayed as a pop-up window ( view = popup ).
        • •
          Leaves the captcha on the page if it is displayed as a block ( view = block ).
          You can set the captcha to close manually with the method captchaWidget.close() .
      4. 4.
        VK ID Captcha SDK Web returns a promise to your web application with success_token .
      5. 5.
        The web application sends the API VKontakte a re-request (step 1), in response to which the captcha error returned. In the request you need to pass success_token with the received token value.
    • •
      Failed scenario: the user is a bot.
      1. 1.
        The VKontakte API sends an error to the Captcha iframe.
      2. 2.
        The user is blocked. A rerun of the captcha is only possible during a new session.
    • •
      Unsuccessful scenario: the user closed the captcha window.
      1. 1.
        The VKontakte API returns an error to the Captcha iframe.
      2. 2.
        The Captcha iframe returns a Captcha SDK Web error to the VK ID.
      3. 3.
        VK ID Captcha SDK Web returns a promise with an error error = close .
  10. 10.
    The web application displays the result of the captcha to the user.