🔧 chore: change selected data when create user session
These changes include: 1. Changes to the response structure when logging in with a third-party provider, by wrapping the token in `authToken` instead of directly entering it in the return data section. 2. Adding a type to user session creation by taking only the important elements. This is to prevent data leaks because important data is in jwt.
This commit is contained in:
@ -10,13 +10,10 @@ export const githubCallbackController = async (
|
||||
try {
|
||||
const userHeaderInfo = getUserHeaderInformation(ctx);
|
||||
|
||||
const userData = await githubCallbackService(ctx.query, userHeaderInfo);
|
||||
return returnWriteResponse(
|
||||
ctx.set,
|
||||
200,
|
||||
"Authenticated successfully!",
|
||||
userData
|
||||
);
|
||||
const authToken = await githubCallbackService(ctx.query, userHeaderInfo);
|
||||
return returnWriteResponse(ctx.set, 200, "Authenticated successfully!", {
|
||||
authToken,
|
||||
});
|
||||
} catch (error) {
|
||||
return mainErrorHandler(ctx.set, error);
|
||||
}
|
||||
|
||||
@ -10,13 +10,10 @@ export const googleCallbackController = async (
|
||||
try {
|
||||
const userHeaderInfo = getUserHeaderInformation(ctx);
|
||||
|
||||
const userData = await googleCallbackService(ctx.query, userHeaderInfo);
|
||||
return returnReadResponse(
|
||||
ctx.set,
|
||||
200,
|
||||
"Authenticated successfully!",
|
||||
userData
|
||||
);
|
||||
const authToken = await googleCallbackService(ctx.query, userHeaderInfo);
|
||||
return returnReadResponse(ctx.set, 200, "Authenticated successfully!", {
|
||||
authToken,
|
||||
});
|
||||
} catch (error) {
|
||||
return mainErrorHandler(ctx.set, error);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user