While using AEM in local setup, what token credentials should I put in? | Community
Skip to main content
July 7, 2022

While using AEM in local setup, what token credentials should I put in?

  • July 7, 2022
  • 2 replies
  • 1697 views

I am trying to use local node client thats available at https://experienceleague.adobe.com/docs/experience-manager-learn/assets/aem-guides_token-authentication-external-application.zip?lang=en

 

I see that we have a params object which is expected to have `developerCredentials` field:

 

```

// Command line parameters
let params = { };

/**
* Application entry point function
*/
(async () => {
console.log('Example usage: node index.js aem=https://author-p1234-e5678.adobeaemcloud.com propertyName=metadata/dc:rights propertyValue="WKND Limited Use" folder=/wknd/en/adventures/napa-wine-tasting file=credentials-file.json' );

// Parse the command line parameters
params = getCommandLineParams();
 
// Set the access token to be used in the HTTP requests to be local development access token
params.accessToken = await getAccessToken(params.developerConsoleCredentials);

// Get a list of all the assets in the specified folder
let assets = await listAssetsByFolder(params.folder);

// For each asset, update it's metadata
await assets.forEach(asset => updateMetadata(asset, {
[params.propertyName]: params.propertyValue
}));
})();

```

 

while developing locally, I wanted to know how can I connect to AEM that's running on localhost:4502. Do I need to have local access token generated from cloud for this as well since I am just using `localhost` server and nothing from AEM cloud.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

2 replies

arunpatidar
Community Advisor
Community Advisor
July 7, 2022

Hi,

To connect local AEM , you can use the AEM login credentials when you make request.

But if you are using AEM publish instance then you can connect without any credentials.

Arun Patidar
July 7, 2022

I didn't completely get you when you say login credentials. I have set login credentials as admin and admin, now I want to make a request to a given graphQL endpoint,

do I keep it as `Bearer username:password` in Authorization or should I do something else?

Adobe Employee
July 7, 2022
You can easily do the Basic AUthentication for local instace and Token based for AEM which is hosted on cloud.
For instance - When we want to access an endpoint from our AEM instance using POSTMAN, we need to set the Authentication information via  tab -> "Authorization" with respective Type. (Which would help generate an Authorization Header for making an HTTP request)
  • For Classic AEM instance, we need to use "Basic" Type -> respective Username and Password input as we would give in our AEM instance.
  • For AEMasCS instance(the one as hosted in cloud and NOT Cloud Service SDK instance), we need to use Token Based Authentication -> "Bearer" Type -> Token value as input. Which you already know.
July 7, 2022

Currently, I am only running the AEM JAR file locally on my system, I want to connect to the same and utilise GQL endpoints. For that can you tell me what I need to do, if I want to make request from postman?

sunil_kumar_
July 8, 2022

Hi @shivam-rally , What are you trying to achive here. Do you want to perform any remote operation in AEM.  You can perform using postman using basic authrntication(user/password).
check my comment here-

https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/create-page-site-from-a-simple-java-project/m-p/456467/highlight/true#M131390

Or if you are interested, Check this video tutorial -
https://youtu.be/rCoGndHr7HQ