Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events
SOLVED

Obtain session instance in CQ

Avatar

Level 9

Hi All,

In order to obtain a session,

final SlingRepository repos = sling.getService(SlingRepository.class); and session = repos.loginAdministrative(null); is used in the article https://helpx.adobe.com/experience-manager/using/using-ajax-requests-display-cq.html . But I read somewhere that loginAdministrative is now deprecated.

Can you please let me know, some of the other ways in which a session can be obtained.

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

Right those are deprecated, Now you need to create service and map that service to user in OSGI

Take a look at step by step guide here @ http://www.wemblog.com/2014/08/how-to-use-sessions-and-resource.html

View solution in original post

1 Reply

Avatar

Correct answer by
Level 10

Hi,

Right those are deprecated, Now you need to create service and map that service to user in OSGI

Take a look at step by step guide here @ http://www.wemblog.com/2014/08/how-to-use-sessions-and-resource.html