diff --git a/packages/backend-core/src/db/utils.js b/packages/backend-core/src/db/utils.js
index c6ca1273bc..4632b709c0 100644
--- a/packages/backend-core/src/db/utils.js
+++ b/packages/backend-core/src/db/utils.js
@@ -445,3 +445,4 @@ exports.getConfigParams = getConfigParams
exports.getScopedFullConfig = getScopedFullConfig
exports.generateNewUsageQuotaDoc = generateNewUsageQuotaDoc
exports.generateDevInfoID = generateDevInfoID
+exports.getPlatformUrl = getPlatformUrl
diff --git a/packages/backend-core/src/middleware/passport/datasource/google.js b/packages/backend-core/src/middleware/passport/datasource/google.js
index 270af4dec8..96c7f99953 100644
--- a/packages/backend-core/src/middleware/passport/datasource/google.js
+++ b/packages/backend-core/src/middleware/passport/datasource/google.js
@@ -1,8 +1,8 @@
const google = require("../google")
const { Cookies, Configs } = require("../../../constants")
const { clearCookie, getCookie } = require("../../../utils")
+const { getScopedConfig, getPlatformUrl } = require("../../../db/utils")
const { doWithDB } = require("../../../db")
-const { getScopedConfig } = require("../../../db/utils")
const environment = require("../../../environment")
const { getGlobalDB } = require("../../../tenancy")
@@ -21,10 +21,20 @@ async function fetchGoogleCreds() {
)
}
+async function platformUrl() {
+ const db = getGlobalDB()
+ const publicConfig = await getScopedConfig(db, {
+ type: Configs.SETTINGS,
+ })
+ return getPlatformUrl(publicConfig)
+}
+
async function preAuth(passport, ctx, next) {
// get the relevant config
const googleConfig = await fetchGoogleCreds()
- let callbackUrl = `${environment.PLATFORM_URL}/api/global/auth/datasource/google/callback`
+ const platUrl = await platformUrl()
+
+ let callbackUrl = `${platUrl}/api/global/auth/datasource/google/callback`
const strategy = await google.strategyFactory(googleConfig, callbackUrl)
if (!ctx.query.appId || !ctx.query.datasourceId) {
@@ -41,14 +51,15 @@ async function preAuth(passport, ctx, next) {
async function postAuth(passport, ctx, next) {
// get the relevant config
const config = await fetchGoogleCreds()
+ const platUrl = await platformUrl()
- let callbackUrl = `${environment.PLATFORM_URL}/api/global/auth/datasource/google/callback`
+ let callbackUrl = `${platUrl}/api/global/auth/datasource/google/callback`
const strategy = await google.strategyFactory(
config,
callbackUrl,
(accessToken, refreshToken, profile, done) => {
clearCookie(ctx, Cookies.DatasourceAuth)
- done(null, { accessToken, refreshToken })
+ done(null, { refreshToken })
}
)
diff --git a/packages/builder/src/components/backend/DatasourceNavigator/TableIntegrationMenu/PlusConfigForm.svelte b/packages/builder/src/components/backend/DatasourceNavigator/TableIntegrationMenu/PlusConfigForm.svelte
index 66d7d43841..c94e750c29 100644
--- a/packages/builder/src/components/backend/DatasourceNavigator/TableIntegrationMenu/PlusConfigForm.svelte
+++ b/packages/builder/src/components/backend/DatasourceNavigator/TableIntegrationMenu/PlusConfigForm.svelte
@@ -15,7 +15,6 @@
import ArrayRenderer from "components/common/renderers/ArrayRenderer.svelte"
import ConfirmDialog from "components/common/ConfirmDialog.svelte"
import { goto } from "@roxi/routify"
- import GoogleButton from "../_components/GoogleButton.svelte"
export let datasource
export let save
@@ -161,11 +160,6 @@
Fetch tables
- {#if integration.auth}
- {#if integration.auth.type === "google"}
-