chore: add env var for social login (#7251)

This commit is contained in:
Pablo Lara
2025-04-09 16:07:30 +02:00
committed by Pepe Fagoaga
parent d1f04fefb0
commit c1e36f0df7
4 changed files with 9 additions and 5 deletions
+3 -2
View File
@@ -3,6 +3,7 @@
import { NextResponse } from "next/server";
import { signIn } from "@/auth.config";
import { baseUrl } from "@/lib/helper";
export async function GET(req: Request) {
const { searchParams } = new URL(req.url);
@@ -42,14 +43,14 @@ export async function GET(req: Request) {
accessToken: access,
refreshToken: refresh,
redirect: false,
callbackUrl: "/",
callbackUrl: `${baseUrl}/`,
});
if (result?.error) {
throw new Error(result.error);
}
return NextResponse.redirect(new URL("/", req.url));
return NextResponse.redirect(new URL("/", baseUrl));
} catch (error) {
// eslint-disable-next-line no-console
console.error("SignIn error:", error);
+3 -2
View File
@@ -3,6 +3,7 @@
import { NextResponse } from "next/server";
import { signIn } from "@/auth.config";
import { baseUrl } from "@/lib/helper";
export async function GET(req: Request) {
const { searchParams } = new URL(req.url);
@@ -42,14 +43,14 @@ export async function GET(req: Request) {
accessToken: access,
refreshToken: refresh,
redirect: false,
callbackUrl: "/",
callbackUrl: `${baseUrl}/`,
});
if (result?.error) {
throw new Error(result.error);
}
return NextResponse.redirect(new URL("/", req.url));
return NextResponse.redirect(new URL("/", baseUrl));
} catch (error) {
// eslint-disable-next-line no-console
console.error("SignIn error:", error);
+2
View File
@@ -1,6 +1,8 @@
import { getTask } from "@/actions/task";
import { AuthSocialProvider, MetaDataProps, PermissionInfo } from "@/types";
export const baseUrl = process.env.AUTH_URL || "http://localhost:3000";
export const getAuthUrl = (provider: AuthSocialProvider) => {
const config = {
google: {