Expand my Community achievements bar.

SOLVED

AEM adaptive forms rest service test return unauthorized

Avatar

Level 4

Hi All,

 

I am trying to integrate REST API with adaptive form using form data model. My REST api doesn't have any authentication but i get below error when i test the connection.

 

{
"errorCode": "AEM-FDM-001-016",
"errorMessage": "Error occurred while invoking the service.",
"originCode": "500",
"originMessage": "Unauthorized request"
}

 

My swagger file is good and i am able to see all the fields extracted from swagger.

 

Did anyone faced the same issue? let me know if there any solution for this or need to raise daycare ticket.

 

Thanks,

Vikram.

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Employee
3 Replies

Avatar

Correct answer by
Employee

Avatar

Level 2

Bit late but might help other people who are setting up forms.

Root cause 

1) The Form Data Model will use authentication mechanism Configured in AEM  cloudservices/datasource. If you have selected no authentication during setup - it will use anonymous user.  In Author env - anonymous user is restricted cannot read /content . so code will throw unauthorsied access. (Developer might get tricked if he/she thinks his logged in ID is used in FDM ).

Solution

1) Configure authentication settings in AEM cloudservices datasource. Make sure that user has all rights needed to call the API and read content etc .

2) Configure logs for DermisServlet and other forms code to debug it

Avatar

Administrator

@dkumar_gobi Thank you for sharing this with Community. 



Kautuk Sahni