Session

This component represents a user's active TalkJS session. It handles authenticating your app with TalkJS. You need to ensure that your users can only have a TalkJS session when they have a valid session in your app.

A Session component can be used standalone or with Chatbox as its descendant. If you need to use a Chatbox then it MUST be a descendant of Session. It, however, does not need to be a direct descendant.

Props

NameTypeDescription
appId Required
stringYour app's unique TalkJS id. Get it from the dashboard.
me Required
UserA User object that identifies the currently active user. The user is uniquely identified by their id.
enablePushNotifications
booleanThis determines whether push notifications will be sent to the device the user is currently using.
signature
stringThis is the HMAC-SHA256 hash of the current user id, signed with your TalkJS secret key. It is used as part of Identity Verification

Example

<Session
appId='YOUR_APP_ID'
me={{
id: '123456789',
name: 'Alice',
photoUrl: 'https://talkjs.com/images/avatar-1.jpg',
role: 'default'
}}
enablePushNotifications={true}
signature='HMAC-SHA256_OF_USER_ID'
/>