Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

login and logout

Avatar

Former Community Member

Hi,

I have an application that uses lccs. All users are authenticated as guests. My problem is that I can't logout a user in order to login another user. For both users I use different authenticators (new AdobeHSAuthenticator objects with different names and no passwords). When I call connectSessionContainer.logout (also tried with close() ) everything seems to be fine. ConnectSessionContainer.isSynchronized is equal false, so I guess this means the user is logged out. However when I try to login the second user using the same connectSessionContainer I can see that after connectSessionContainer.isSynchronized is equal true the user descriptor contains the same display name even though there is a new authenticator with a new name. So when I want to send a message to SimpleChatModel, the MessageDescriptor uses displayName of the previous user. I don't understand why whould userManager.myUserDescriptor keep the same display name after relogging. I guess there's something fundamentally wrong with my understanding of how lccs works. How can I logout and login again so that userManager.myUserDescriptor would be changed ?

Many thanks,
Piotr

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

Hi Piotr (and sorry for the long-ish wait),


I think what's happening in this case is that the AdobeHSAuthenticator's authenticationKey is remembering the last session token you used. Try something like :

cSession.authenticator.authenticationKey = null;

cSession.authenticator.userName = "whatever";

cSession.login();

nigel

View solution in original post

2 Replies

Avatar

Correct answer by
Former Community Member

Hi Piotr (and sorry for the long-ish wait),


I think what's happening in this case is that the AdobeHSAuthenticator's authenticationKey is remembering the last session token you used. Try something like :

cSession.authenticator.authenticationKey = null;

cSession.authenticator.userName = "whatever";

cSession.login();

nigel

Avatar

Former Community Member

It worked out, thanks!!!

In my case I had to keep existing authenticator and set authenticationKey to null as you suggested. Creating a new authenticator wouldn't make it work.

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----