Expand my Community achievements bar.

How to get logged user session details in AEM

Avatar

Level 3

Hello All,

               I am trying to get logged in user session details in my java servlet like user name,password,group,permission and complete profile details.

In case of administrator logged in I am able get all details successfully but in case of other user I am getting error of "Anonymous ".

1.http://localhost:port/useradmin  AEM Page-  I have applied all r/w permission to my user.

2.By using AEM my user login token I have checked my rest API method call and I am able get user session details in this scenario also.

3.But when I am trying with same rest API method call from my HTML5 application I am facing the "Anonymous " error problem.

Thanks

Qamar

1 Reply

Avatar

Community Advisor

@Qamar_khan It may be because the session is not authenticated.

 

  • Ensuring proper authentication headers or cookies are sent.
  • Verifying CORS configuration.
  • Double-check user permissions for the servlet and relevant resources.

    Configure CORS in AEM:

    • Navigate to /system/console/configMgr.
    • Search for Adobe Granite Cross-Origin Resource Sharing Policy.
    • Add your HTML5 app's domain (e.g., http://your-app-domain.com) to the Allowed Origins list.
    • Enable Allow-Credentials.