[WEB-2729] chore: updated live server auth cookies handling (#5913)

* chore: updated live server auth cookies handling

* chore: update token parsing logic

* fix: types and better logical seperation between the existing two tokens

* fix: better fallback to use request headers for cookies

---------

Co-authored-by: Palanikannan M <akashmalinimurugu@gmail.com>
This commit is contained in:
Lakhan Baheti 2024-10-30 17:38:29 +05:30 committed by GitHub
parent 403482fa6e
commit 8ea34b5995
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 54 additions and 33 deletions

View file

@ -39,7 +39,7 @@ export const useCollaborativeEditor = (props: TCollaborativeEditorProps) => {
name: id,
parameters: realtimeConfig.queryParams,
// using user id as a token to verify the user on the server
token: user.id,
token: JSON.stringify(user),
url: realtimeConfig.url,
onAuthenticationFailed: () => {
serverHandler?.onServerError?.();

View file

@ -138,6 +138,7 @@ export type TUserDetails = {
color: string;
id: string;
name: string;
cookie?: string;
};
export type TRealtimeConfig = {