Expand my Community achievements bar.

Unable to access dam using oauthservice system user

Avatar

Level 3

I'm trying to access images in the dam from the third party pdf generator. I'm using oauthservice system user by the writeService OSGI configuration setting. I also gave permissions to  oauthservice user. Now I'm unable to generate an image in the pdf. It worked in AEM 6.1, but not in AEM 6.3. Also, it's working if I provide "admin" username and password.But, I don't wanna use admin details. Can you please help if I'm missing anything here...

12 Replies

Avatar

Level 10

Did you read in the AEM documentation that this user type was supported?

I couldn't find anything that this is not supported. I might miss some thing. Can you please mention any documentation to implement this functionality in a recommended way.

Thanks in advance

Avatar

Level 10

Typically to access a resource in the JCR -  you need to use a session of an AEM user whom has permission to access this location.

Yeah, That's true. Here I used oauthservice system user and gave permissions for the DAM images folder. But this is not working in 6.3

Avatar

Level 10

For a test - can you try a normal AEM user with permission to access this JCR location.

This worked but, here again, I have to mention username and password of the user in the service which I don't want to do. Is there any other way that I can do to achieve this?

Avatar

Level 10

If you are writing an AEM Service (OSGi bundle) to get access to the JCR - you should be using an AEM System user and Sling Mapping Service as discussed here:

Scott's Digital Community: Querying Adobe Experience Manager 6 data using the Sling getServiceResour...

Avatar

Level 10

Using a System user and Sling Mapping Service represents best practice to get a session.

But, as I mentioned in my original question, I'm using the system user and Sling Mapping Service but pdf generator is not being able to access the images in dam

Avatar

Level 10

Did not recognize oauthservice to mean a system user.

First - this is running as an AEM bundle on the local AEM instance - right?

When configuring the Sling Mapping Service - make sure you are specifying the Symbolic Bundle name as mentioned in the article that i referenced.

If you have not configured the Sling Mapping Service - then you will get a NULL in your code.

ALso - make sure the system user has the required permissions to access the JCR.

Watch the video too where we step you through all of this.

Avatar

Level 3

I'm using this in SlingAllMethodsServlet coz every user should be able to generate pdf and the servlet is inside bundle. I configured the Bundle Symbolic name in the Sling Mapping Service configuration. I also checked that I gave permission to the oauthservice user for the location. But still not sure why pdf generator is not able to access the images.

below are the configs

config.setLicenseKey(license);

config.setBaseURL(URL);

config.setAuthenticationCredentials(new KeyValuePair("oauthservice", ""));       

is there any wrong in this config setting because the same setting worked in 6.1 but, not in 6.3.

Avatar

Level 10

Yes, Scott is right..you need to use system user and Sling mapping service to get a session!!

Ratna.