🚩 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:
@ -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,
|
||||
|
||||
Reference in New Issue
Block a user