Skip to content

Commit

Permalink
[nan-661] use public server url (NangoHQ#1932)
Browse files Browse the repository at this point in the history
## 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:
  • Loading branch information
khaliqgant authored Apr 1, 2024
1 parent 8e28a7c commit 2066cfc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/server/lib/controllers/auth.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
Expand Down
2 changes: 1 addition & 1 deletion packages/utils/lib/environment/detection.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand Down

0 comments on commit 2066cfc

Please sign in to comment.