Expand my Community achievements bar.

Create a page that match with given figma design AEM local instance using n8n ai agent workflow

Avatar

Level 2

Wjen i was trying to create n8n workflow for the task it always fails as forbidden credentials or 403

5 Replies

Avatar

Employee Advisor

Hello @mohamedvalith ,

As the request is failing with a 403 Forbidden error, which indicates that the API is rejecting the credentials or blocking the request from n8n.

To proceed, could you please confirm the following so we can narrow down the issue:

  1. Are the correct API credentials/scopes enabled for this request?

  2. Has the n8n server IP been allow-listed on your side (if required by your firewall/WAF)?

  3. Are there any restrictions on the HTTP method or endpoint being called?

Once we have this information, we can validate the setup and help resolve the issue quickly.

Avatar

Level 2

thanks for your response, it is not even gone to the figma call. it is getting failed in the connection establishment to AEM local instance node itself.

 

i am try to achieve it using my n8n local setup. and i was removed all figma related nodes and try to run workflow to establish connection to AEM local and create a page. but that also getting failed. 

 

workflow json:

{
"name": "Create AEM Page with RAW Body and Cookies",
"nodes": [
{
"parameters": {},
"id": "33168164-e8f6-4364-9b1c-9963abb8bea7",
"name": "Manual Trigger",
"type": "n8n-nodes-base.manualTrigger",
"typeVersion": 1,
"position": [
128,
352
]
},
{
"parameters": {
"authentication": "genericCredentialType",
"genericAuthType": "httpBasicAuth",
"url": "https://ac27b425062f.ngrok-free.app/libs/granite/csrf/token.json",
"options": {}
},
"id": "e4419cd6-d308-4b4c-9eb8-0987e20aa959",
"name": "Fetch CSRF Token",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 2,
"position": [
480,
496
]
},
{
"parameters": {
"authentication": "genericCredentialType",
"genericAuthType": "httpBasicAuth",
"url": "https://ac27b425062f.ngrok-free.app/content/etisalat/language-master/en/c/demo/ai-pages/",
"responseFormat": "string",
"options": {},
"headerParametersUi": {
"parameter": [
{
"name": "Content-Type",
"value": "multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW"
},
{
"name": "CSRF-Token",
"value": "={{$json[\"token\"]}}"
}
]
}
},
"id": "c77c7936-8f4b-4021-9ef0-c5fb06bc69d2",
"name": "Create AEM Page",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 2,
"position": [
672,
496
]
}
],
"pinData": {},
"connections": {
"Manual Trigger": {
"main": [
[
{
"node": "Fetch CSRF Token",
"type": "main",
"index": 0
}
]
]
},
"Fetch CSRF Token": {
"main": [
[
{
"node": "Create AEM Page",
"type": "main",
"index": 0
}
]
]
}
},
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "dc5be432-f477-46c6-9ef1-43e981963ba6",
"meta": {
"instanceId": "b97237cc69f620ea38279603a37a4dd77020f20940bc140c02e848442ce68a0b"
},
"id": "n9Pj58b3kPlxcoRV",
"tags": []
}

Avatar

Community Advisor and Adobe Champion

When using n8n to connect to your local AEM instance (AEMaaCS SDK) and automate tasks like creating pages, a 403 Forbidden error usually means authentication is missing or incorrect.

Recommended for Local Testing:

  1. Use Basic Authentication
    AEM (especially the local SDK) expects a Basic Auth header for tools like n8n.
    You can log in with your AEM credentials (e.g., admin:admin) and generate the Authorization header in Base64 format.

    Follow this guide to get the correct header:
    How to Get Authorization Basic Auth Header from AEM -  https://sourcedcode.com/blog/aem/how-to-get-authorization-basic-auth-header-from-aem-author 

  2. Make Sure the POST Call is Correct
    Since n8n acts as an HTTP client, it’s important your POST request matches AEM’s expectations (headers, content type, and CSRF handling if needed).

    This tutorial explains how to make proper POST requests to AEM using an HTTP client:
    How to Make Simple HTTP POST Methods in AEM with an HTTP REST Client - https://sourcedcode.com/blog/video-tutorial/how-to-make-simple-http-post-methods-in-aem-with-a-http-... 

Avatar

Level 2

thanks for your reply. i am tried your suggessions. basic authontication was getting proper responce. instead of using postman i am try to trigger it from terminal using below.

 

curl -u admin:admin \

  -F"jcr:primaryType=cq:Page" \

  -F"jcr:content/jcr:primaryType=cq:PageContent" \

  -F"jcr:content/jcr:title=My New Page" \

  -F"jcr:content/sling:resourceType=myapp/components/page" \

  -F"jcr:content/cq:template=/conf/myapp/settings/wcm/templates/page-template" \

  http://localhost:4502/content/mysite/my-new-page


above command work find in terminal. and creates new page as per given conffiguration. but while create a n8n node for the same it getting failed. 

 

foollowing is the error log:

{
"errorMessage": "Forbidden - perhaps check your credentials?",
"errorDetails": {
"rawErrorMessage": [
"403 - \"\\n\""
],
"httpCode": "403"
},
"n8nDetails": {
"nodeName": "Create AEM Page",
"nodeType": "n8n-nodes-base.httpRequest",
"nodeVersion": 1,
"itemIndex": 0,
"time": "11/8/2025, 11:28:27 PM",
"n8nVersion": "1.118.2 (Cloud)",
"binaryDataMode": "filesystem",
"stackTrace": [
"NodeApiError: Forbidden - perhaps check your credentials?",
" at ExecuteContext.execute (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-nodes-base@file+packages+nodes-base_@aws-sdk+credential-providers@3.808.0_asn1.js@5_afd197edb2c1f848eae21a96a97fab23/node_modules/n8n-nodes-base/nodes/HttpRequest/V1/HttpRequestV1.node.ts:1032:12)",
" at processTicksAndRejections (node:internal/process/task_queues:105:5)",
" at WorkflowExecute.executeNode (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@file+packages+core_@opentelemetry+api@1.9.0_@opentelemetry+sdk-trace-base@1.30_08b575bec2313d5d8a4cc75358971443/node_modules/n8n-core/src/execution-engine/workflow-execute.ts:1093:8)",
" at WorkflowExecute.runNode (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@file+packages+core_@opentelemetry+api@1.9.0_@opentelemetry+sdk-trace-base@1.30_08b575bec2313d5d8a4cc75358971443/node_modules/n8n-core/src/execution-engine/workflow-execute.ts:1274:11)",
" at /usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@file+packages+core_@opentelemetry+api@1.9.0_@opentelemetry+sdk-trace-base@1.30_08b575bec2313d5d8a4cc75358971443/node_modules/n8n-core/src/execution-engine/workflow-execute.ts:1708:27",
" at /usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@file+packages+core_@opentelemetry+api@1.9.0_@opentelemetry+sdk-trace-base@1.30_08b575bec2313d5d8a4cc75358971443/node_modules/n8n-core/src/execution-engine/workflow-execute.ts:2324:11"
]
}
}

Avatar

Community Advisor and Adobe Champion

Try looking at your AEM error logs, it may give you additional information. The following error log looks like its coming from your n8n application.