Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.

Integrate Alibaba captcha in AEMaacs

Avatar

Level 3

Hi,

 

I have a requirement to integrate Alibaba cloud captcha in AEM sites.

 

I am following the below document for reference. 

 

https://www.alibabacloud.com/help/en/captcha/captcha2-0/user-guide/add-a-web-or-html5-client-to-alib...

 

 

But when I try to add the maven dependency for aliyun, I am getting an error in project.all module.

My dependency is:
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>captcha20230305</artifactId>
<version>1.1.2</version>
<scope>provided</scope>
</dependency>


The error I am getting is:

 


[ERROR] The analyser found the following errors for author and publish :
[ERROR] [api-regions-exportsimports] com.abc:aem-abc-project.core:4.1.0: Bundle aem-abc-project.core:4.1.0 is importing package(s) [com.aliyun.teaopenapi.models, com.aliyun.captcha20230305.models, com.aliyun.captcha20230305] in start level 20 but no bundle is exporting these for that start level. (com.abc:aem-abc-project.all:4.1.0)

 

 

@arunpatidar @lukasz-m @BrianKasingli 

 

 

 

8 Replies

Avatar

Community Advisor

Hi,


Do you have any specific questions besides whether someone has experience with this product? I have integrated various types of CAPTCHAs besides Google for different sites, and generally, you shouldn't encounter any issues. The documentation looks good. Just keep in mind to load this on demand to avoid performance issues.

Hope this helps



Esteban Bustamante

Avatar

Community Advisor

Just a friendly reminder: this is not an AEM-specific question but a broader question about using Alibaba's captcha. For more detailed assistance, feel free to consult other forums or Alibaba's official support. However, a quick look at the documentation shows that, if you follow the Integration Guide here: Integration Guide, it states that once you purchase the product, you will receive the credentials needed to invoke and verify the captcha.

 

EstebanBustamante_0-1722258125037.png

In other words, with the credentials you obtain after purchasing the product, you can use something like this (as shown in the Alibaba documentation):

 

// 1. Integrate the main JavaScript code.
<script type="text/javascript" src="https://o.alicdn.com/captcha-frontend/aliyunCaptcha/AliyunCaptcha.js"></script>
// 2. Create a <script> tag to call the initializer function initAliyunCaptcha.
<script>
  let captcha;
  // Pop-up CAPTCHA
  initAliyunCaptcha({
    SceneId: 'c9h3****', // The scenario ID.
    prefix: '89****', // The identity of the CAPTCHA 2.0 instance that you purchase.
    mode: 'popup', // The CAPTCHA mode.
    element: '#captcha-element', 
    button: '#button', // The element that triggers the pop-up CAPTCHA window.
    captchaVerifyCallback: captchaVerifyCallback,
    onBizResultCallback: onBizResultCallback,
    getInstance: getInstance, 
    slideStyle: {
      width: 360,
      height: 40,
    }, 
    language: 'cn', 
    region: 'cn'
  });

 

The initAliyunCaptcha() from the Alibaba JS framework will verify and validate, so all the calls, endpoints, etc are handled internally for that function. Please check the documentation that explains how to use the callbacks to interact with the verification response (captchaVerifyCallback).


Hope this helps.


 



Esteban Bustamante

Avatar

Level 3

Hi @EstebanBustamante , I have updated the issue with AEM while adding aliyun dependency. Could you please check.

Avatar

Community Advisor

@SRC_AEM_DEV, is this a different issue you're facing now? It doesn’t seem like you originally asked about this. I would suggest tackling one issue per thread. If your original question has been resolved, please close this thread and open a new one for the current issue. This approach keeps the discussions cleaner and more organized, which benefits all community members.

 

The error is clear: the "aem-analyzer" plugin detects that your "aliyun" dependency won’t be available at runtime (when your code runs on AEM) with the current bundle configuration. To resolve this, you need to wrap this external dependency as part of your bundle so that it can be deployed into the AEM instance.

For more details on how to solve this issue, please check this link: https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/getting-error-while-buildi....

 

Hope this helps.



Esteban Bustamante

Avatar

Administrator

@SRC_AEM_DEV Did you find the suggestions from users helpful? Please let us know if you require more information. Otherwise, please mark the answer as correct for posterity. If you've discovered a solution yourself, we would appreciate it if you could share it with the community. Thank you!



Kautuk Sahni

Avatar

Level 3

Hi @kautuk_sahni , I did not find the solution. I am still facing the same issue regarding the aliyun dependency.

Avatar

Community Advisor

@SRC_AEM_DEV It looks like you have updated the original question, which suggests that your initial query about the JS library has been resolved and you now understand how to use it. If your original question has indeed been resolved, please close this thread and open a new one for the current dependency issue. This approach keeps discussions cleaner and more organized, benefiting all community members.

 

cc: @kautuk_sahni 



Esteban Bustamante