From 2066cfc2c75f2b59f4c8a7fa4c81721eb4f7923c Mon Sep 17 00:00:00 2001 From: Khaliq Date: Mon, 1 Apr 2024 20:23:22 +0300 Subject: [PATCH] [nan-661] use public server url (#1932) ## Describe your changes Use public server url variable instead of faulty replacement logic ## Issue ticket number and link NAN-661 ## Checklist before requesting a review (skip if just adding/editing APIs & templates) - [ ] I added tests, otherwise the reason is: - [ ] I added observability, otherwise the reason is: - [ ] I added analytics, otherwise the reason is: --- packages/server/lib/controllers/auth.controller.ts | 2 +- packages/utils/lib/environment/detection.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/server/lib/controllers/auth.controller.ts b/packages/server/lib/controllers/auth.controller.ts index f84874b5c5..6d0203d541 100644 --- a/packages/server/lib/controllers/auth.controller.ts +++ b/packages/server/lib/controllers/auth.controller.ts @@ -380,7 +380,7 @@ class AuthController { clientId: process.env['WORKOS_CLIENT_ID'] || '', provider, redirectUri: `${basePublicUrl}/api/v1/login/callback`, - state: JSON.stringify(inviteParams) + state: Buffer.from(JSON.stringify(inviteParams)).toString('base64') }); res.send({ url: oAuthUrl }); diff --git a/packages/utils/lib/environment/detection.ts b/packages/utils/lib/environment/detection.ts index 251d635792..784c676980 100644 --- a/packages/utils/lib/environment/detection.ts +++ b/packages/utils/lib/environment/detection.ts @@ -1,7 +1,7 @@ import { NodeEnv, localhostUrl } from './constants.js'; export const baseUrl = process.env['NANGO_SERVER_URL'] || localhostUrl; -export const basePublicUrl = process.env['NANGO_SERVER_URL'] ? process.env['NANGO_SERVER_URL'].replace('api.', 'app.') : baseUrl; +export const basePublicUrl = process.env['NANGO_PUBLIC_SERVER_URL'] || baseUrl; export const isStaging = process.env['NODE_ENV'] === NodeEnv.Staging; export const isProd = process.env['NODE_ENV'] === NodeEnv.Prod;