Expand my Community achievements bar.

Adaptive Forms Integration with external APIs via user's Access token

Avatar

Level 3

Hi there,
I'm working on a requirement where we have to create a "Service Request Form" via Adaptive Form and pre populate the customer data on page load via calling some external APIs. These APIs expecting "Access token" to give us the user's bank account details. 

We've created a OAuth Service which connects to some other APIs and give us the access token and now we need to pass that access token from AEM to external APIs, gets the user specific data and prefilled the Adaptive forms.

We're trying to figure out a best way forward for this requirement to implement from Adaptive forms perspective. Kindly let me know your thoughts.


Approach 1:  Create Custom Javascript to make a ajax call to Servlet. This servlet will connect to external APIs and get the response.

Approach 2: Use Custom Authentication OOTB feature of Adaptive forms to create the datasource but I did not find any reference how we can utilize this ootb feature our requirement.

aemuser2021_0-1711529616591.png


Pls let me know your thoughts on this or if anyone has worked on similar kind of requirement before.

Thanks.

3 Replies

Avatar

Level 3

I've tried this option too but it doesn't seem to work. 

Avatar

Level 1

Hi
If the OAuth service which you have created is designed as per OAuth spec. Then you can use the OAuth authentication directly which we provide out of the box. No extra efforts required, just provide the auth details such as client id/secret/access token url etc and we are good to go. Screenshot attached.

If it's some sort custom logic for authentication to retrieve access token, then you can implement custom authentication and write your own logic to retrieve access token which will be used by all the api's in the configuration/swagger which connects to external system. Configuration and sample attached.

https://experienceleague.adobe.com/en/docs/experience-manager-cloud-service/content/forms/integrate/...