aem-mcp-server
Version:
AEM Model Context Protocol (MCP) server
2 lines (1 loc) • 672 B
JavaScript
;const i="https://ims-na1.adobelogin.com/ims/token",s="openid,AdobeID,read_organizations,additional_info.projectedProductContext,aem_author_read,aem_author_write",c=t=>t?Array.isArray(t)?t.join(","):t:s;export async function getAccessToken(t,r,n){if(!t||!r)throw new Error("Client ID and Client Secret must be provided");const o=c(n),a=new URLSearchParams({client_id:t,client_secret:r,grant_type:"client_credentials",scope:o}),e=await fetch(i,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:a.toString()});if(!e.ok)throw new Error(`IMS token request failed: ${e.status} ${await e.text()}`);return(await e.json()).access_token}