Expand my Community achievements bar.

SOLVED

CurrentUser.json always returning Anonymous in Publish instance and works well in author

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) 

 

 

USECase : I have to show Login text when user is not loggedin and LOGOUT text with his name  when user is loggedin.

Thanks

@Kautuksahni Your inputs please. 

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

In publish, when you are a not authenticated you are using the "anonymous" user. When you want to work with user identities and different permissions, I would recommend to check the documentation on "Closed User Groups" (CUG).

 

https://experienceleague.adobe.com/docs/experience-manager-learn/assets/advanced/closed-user-groups....

View solution in original post

3 Replies

Avatar

Community Advisor

you should have AEM session and read access to /libs/granite/security/currentuser.json



Arun Patidar

Avatar

Correct answer by
Employee Advisor

In publish, when you are a not authenticated you are using the "anonymous" user. When you want to work with user identities and different permissions, I would recommend to check the documentation on "Closed User Groups" (CUG).

 

https://experienceleague.adobe.com/docs/experience-manager-learn/assets/advanced/closed-user-groups....