🚩 add provision flow in oauth

Create a flow where if the user logs in with a registered Google account, they are immediately authenticated, but if no
account is found, create a new one.
This commit is contained in:
Rafi Arrafif
2025-08-11 22:54:31 +07:00
parent 7ce0e44389
commit 5d79ffd055
8 changed files with 94 additions and 17 deletions

View File

@ -2,12 +2,15 @@ import { Context } from "elysia";
import { returnWriteResponse } from "../../../helpers/callback/httpResponse";
import { mainErrorHandler } from "../../../helpers/error/handler";
import { googleCallbackService } from "../services/http/googleCallback.service";
import { getUserHeaderInformation } from "../../../helpers/http/userHeader/getUserHeaderInformation";
export const googleCallbackController = async (
ctx: Context & { query: { code: string; state: string } }
) => {
try {
const userData = await googleCallbackService(ctx.query);
const userHeaderInfo = getUserHeaderInformation(ctx);
const userData = await googleCallbackService(ctx.query, userHeaderInfo);
return returnWriteResponse(
ctx.set,
200,