🚧 (wip) try to add callback uri option

This commit is contained in:
Rafi Arrafif
2025-09-03 15:34:11 +07:00
parent bf35af294e
commit 86f8c2a96d
2 changed files with 3 additions and 2 deletions

View File

@ -5,7 +5,7 @@ import { googleCallbackService } from "../services/http/googleCallback.service";
import { getUserHeaderInformation } from "../../../helpers/http/userHeader/getUserHeaderInformation"; import { getUserHeaderInformation } from "../../../helpers/http/userHeader/getUserHeaderInformation";
export const googleCallbackController = async ( export const googleCallbackController = async (
ctx: Context & { query: { code: string; state: string } } ctx: Context & { query: { code: string; state: string; callbackURI: string } }
) => { ) => {
try { try {
const userHeaderInfo = getUserHeaderInformation(ctx); const userHeaderInfo = getUserHeaderInformation(ctx);

View File

@ -10,6 +10,7 @@ export const googleCallbackService = async (
query: { query: {
state: string; state: string;
code: string; code: string;
callbackURI?: string;
}, },
userHeaderInfo: UserHeaderInformation userHeaderInfo: UserHeaderInformation
) => { ) => {
@ -25,7 +26,7 @@ export const googleCallbackService = async (
await redis.del(`${process.env.APP_NAME}:pkce:${state}`); await redis.del(`${process.env.APP_NAME}:pkce:${state}`);
// create access token with the result of validating the authorization code that compares access code with validator state // create access token with the result of validating the authorization code that compares access code with validator state
const google = googleProvider(); const google = googleProvider(query.callbackURI);
const tokens = await google.validateAuthorizationCode( const tokens = await google.validateAuthorizationCode(
query.code, query.code,
codeVerifier codeVerifier