Issue in logged with multiple users in same device

Hi Team,
If we are login with new user in the devices, the old user chat history also displaying in the chat window.
In this scenario suppose to display the new user chat instead old user.

Please let me know how to fix this issue.

@chandrasekhar.anasur Platform users are identified using botOptions.userIdentity. Please make sure that right user (distinct) identity is passed on to the bot.

I never used botOptions.userIdentity. Please help to understand and make use of this.

@chandrasekhar.anasur We were referring to the identity the developer has to pass along with clientId and clientSecret while you generate the JWT. This has to be uniquely passed for every unique user connecting to the bot.

Hi Subrahmanyam,

In this application i have used HS256 and channel is Web/Mobile channel.
I m not aware of how to generate the JWT for unique users .Please help to understand and make use of this.

@chandrasekhar.anasur Without JWT you will not be able to connect to Kore.ai bot. So, we will assume you already have a JWT service. There are parameters passed on to JWT. User ID is nothing but “sub” parameter in the payload. For every user it has to be unique. Email ID can be used for “sub”.

In your web channel you must be passing client ID, secret, bot ID, bot name etc. You should see user identity also being passed on. That should be dynamically passed and should not be hard coded.

You should be able to get a lot of freely available information on JWT on internet. Please use the same.

Hi Swagat,

The application is developed using web,ios and android.
inside bot builder tool i have created standard bot KKH ASSISTANT.i didn’t created any JWT service.while creating the Web/Mobile channel i have selected the HS256 .

image

here i m attaching the screenshot for your reference.
and this is the information i m passing in index.html file.

botOptions.userIdentity = ‘chandrasekhar.anasuri@serole.com’;
“clientSecret”: “CbaG9rzxDM0E6Dw9t14xvt4A+Hfu28juKYg55QCkafo=”
botOptions.clientId = “cs-f8bac90e-1cd8-51c3-9a40-88c6be7b71e2”
botOptions.botInfo = {name:“KKH ASSISTANT”,"_id":“st-d38d3eb1-624d-5f79-82aa-e31b7f47eb01”};

and the bot is integrated with web,ios and android.

then the problem here is where inside web,android and ios we need to provide the jwt service and how. please tell me the steps to achieve the every unique user connecting to the bot.

Could you Please help to understand and make use of this.

@chandrasekhar.anasur There is only one problem here. the hard coded botOptions.userIdentity

You do not need to create any JWT services explicitly / separately. It is a URL/ service which you would have mentioned under:
botOptions.JWTUrl ="http://localhost:3000/api/users/sts"; // this is an example.

Also, the root cause is same as the post https://community.kore.ai/t/same-bot-instance-or-session-is-visible-in-all-the-instances/799/8
Let us discuss only in one place. Like already mentioned, how you are dynamically passing the user identity is up to you. Many developers capture it from session if they are storing it from the authentication service.

Hi swagat,

here in On Connect method writing the logic to display the welcome message like

Hello ronan ! Good Evening I’m Lynn, KKH’s MetBot, how can I help you today?

for getting the userid context.session.UserContext.customData.userId

i have written the logic above.

web,android and ios developers are passing the customData inside botOptions.botInfo.

After logged in web developers or android /ios developers passing the customData.

here iam facing an issue because when the user first time login with John it is displaying the welcome message like

Hello John ! Good Evening I’m Lynn, KKH’s MetBot, how can I help you today?

then after two to three minutes logged off and logged in with new user suppose say Stephen then it is showing welcome message like

Hello John ! Good Evening I’m Lynn, KKH’s MetBot, how can I help you today?

here i m getting the problem.but if we given the time difference 10 to 15 minutes it is logged in correctly.
and also the old user chat history also displaying in the chat window.could you please suggest me on this .

@chandrasekhar.anasur If dynamic value can be passed on to

botOptions.botInfo.customData

I do not see a reason why the same dynamic value cannot be assigned to

botOptions.userIdentity

The above issue of repeating message:

Hello John ! Good Evening I’m Lynn, KKH’s MetBot, how can I help you today?

also seems to be userIdentity related.
Platform recognizes customData through userIdentity. For various userIdentity various customData is stored in session.
Default time-out of a session is 15 seconds.

Hi Swagat,

how can i pass dynamically botOptions.userIdentity.

here i m using my email id
botOptions.userIdentity = ‘chandrasekhar.anasuri@serole.com’

could you please suggest me on this.

@chandrasekhar.anasur as stated multiple times, it is up to the developers. You may use javascript to look into local storage if you use cookies etc or use any other method. We cannot further suggest any approach. Please do required R&D. We told you what needs to be done. How - is up to you.