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;