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

This commit is contained in:
Pablo Lara
2025-03-17 10:23:01 +01:00
committed by GitHub
parent 489b5abf82
commit db7ffea24d
4 changed files with 9 additions and 5 deletions

2
.env
View File

@@ -4,7 +4,7 @@
#### Prowler UI Configuration ####
PROWLER_UI_VERSION="stable"
SITE_URL=http://localhost:3000
AUTH_URL=http://localhost:3000
API_BASE_URL=http://prowler-api:8080/api/v1
NEXT_PUBLIC_API_DOCS_URL=http://prowler-api:8080/api/v1/docs
AUTH_TRUST_HOST=true

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);

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);

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: {