[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:
parent
403482fa6e
commit
8ea34b5995
6 changed files with 54 additions and 33 deletions
|
|
@ -7,11 +7,11 @@ const userService = new UserService();
|
|||
|
||||
type Props = {
|
||||
cookie: string;
|
||||
token: string;
|
||||
userId: string;
|
||||
};
|
||||
|
||||
export const handleAuthentication = async (props: Props) => {
|
||||
const { cookie, token } = props;
|
||||
const { cookie, userId } = props;
|
||||
// fetch current user info
|
||||
let response;
|
||||
try {
|
||||
|
|
@ -20,7 +20,7 @@ export const handleAuthentication = async (props: Props) => {
|
|||
manualLogger.error("Failed to fetch current user:", error);
|
||||
throw error;
|
||||
}
|
||||
if (response.id !== token) {
|
||||
if (response.id !== userId) {
|
||||
throw Error("Authentication failed: Token doesn't match the current user.");
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue