Expand my Community achievements bar.

Submissions are now open for the 2026 Adobe Experience Maker Awards.

Mark Solution

This conversation has been locked due to inactivity. Please create a new post.

SOLVED

Fetch Current user in AEM Publish On PageLoad in AEM 6.5.9

Avatar

Level 1

Hi , I am using '/libs/granite/security/currentuser.json' to fetch current user in js. I see it is returning user as expected in Author instance where as In Publish it always returns 'anonymous'. 
I tried logging into Publish AEM but still the user state is not persisting. Is there a way we can achieve this ?

Version of AEM : 6.5
ServicePack : AEM 6.5 Service Pack 9 (6.5.9.0) 

Thanks

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

You can hit the login end-point - /libs/granite/core/content/login.html directly, which will give you the login screen and you should be able to login to Publish instance. 

 

http://localhost:4503/libs/granite/core/content/login.html

View solution in original post

5 Replies

Avatar

Community Advisor

Hi @MadhuriMaddala26 , is it working when you hit the path - http://localhost:4503/libs/granite/security/currentuser.json directly in a browser window instead after logging in? 

 

Avatar

Level 1

Hi ,Thanks for replying.
The issue I see is Publish instance is not allowing us to login I tried with Weretail and I can see the issue there as well. 
http://localhost:4503/libs/granite/security/currentuser.json is always returning anonymous ID. The loggedin state of user is not persisting.

{"type":"user","authorizableId_xss":"anonymous","authorizableId":"anonymous","name_xss":"anonymous","name":"anonymous","home":"/home/users/8/8QmmwYU5F6MOHNiF0XEI","isImpersonated":false}

Is there any other way we can get user name on pageload ?

Avatar

Correct answer by
Community Advisor

You can hit the login end-point - /libs/granite/core/content/login.html directly, which will give you the login screen and you should be able to login to Publish instance. 

 

http://localhost:4503/libs/granite/core/content/login.html

Avatar

Level 1

@kautuk_sahni Need your inputs here please. Thanks

Avatar

Community Advisor

if you are not logged in AEM then you will not get user details.

The default or anonymous user is 'anonymous'

Arun Patidar

AEM LinksLinkedIn