Skip to content

Commit 2444664

Browse files
authored
Add custom domain connect (#538)
Co-authored-by: Martin Kellner <martin.kellner@corbado.com>
1 parent ec7777c commit 2444664

File tree

4 files changed

+9
-2
lines changed

4 files changed

+9
-2
lines changed

packages/connect-react/src/contexts/SharedProvider.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export const SharedProvider: FC<PropsWithChildren<Props>> = ({ children, connect
2020
config.projectId,
2121
config.frontendApiUrlSuffix ?? 'frontendapi.corbado.io',
2222
config.isDebug ?? false,
23+
config.customDomain,
2324
),
2425
);
2526

packages/connect-web-js/src/models/CorbadoState.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export class CorbadoState {
1010
connectConfig.projectId,
1111
connectConfig.frontendApiUrlSuffix ?? 'frontendapi.corbado.io',
1212
connectConfig.isDebug ?? false,
13+
connectConfig.customDomain,
1314
);
1415

1516
this.#connectConfig = connectConfig;

packages/types/src/connect/config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ export type CorbadoConnectConfig = {
4545
frontendApiUrlSuffix?: string;
4646
isDebug?: boolean;
4747
enableHighlight?: boolean;
48+
customDomain?: string;
4849
};
4950

5051
export type CorbadoConnectDemoConfig = {

packages/web-core/src/services/ConnectService.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,14 @@ export class ConnectService {
5555
#projectId: string;
5656
#timeout: number;
5757
readonly #frontendApiUrlSuffix: string;
58+
readonly #customDomain: string | undefined;
5859
#visitorId: string;
5960

60-
constructor(projectId: string, frontendApiUrlSuffix: string, isDebug: boolean) {
61+
constructor(projectId: string, frontendApiUrlSuffix: string, isDebug: boolean, customDomain?: string) {
6162
this.#projectId = projectId;
6263
this.#timeout = 10 * 1000;
6364
this.#frontendApiUrlSuffix = frontendApiUrlSuffix;
65+
this.#customDomain = customDomain;
6466
this.#webAuthnService = new WebAuthnService();
6567
this.#visitorId = '';
6668

@@ -129,7 +131,9 @@ export class ConnectService {
129131

130132
#setApisV2(process?: ConnectProcess): void {
131133
let frontendApiUrl = this.#getDefaultFrontendApiUrl();
132-
if (process?.frontendApiUrl && process?.frontendApiUrl.length > 0) {
134+
if (this.#customDomain && this.#customDomain.length > 0) {
135+
frontendApiUrl = this.#customDomain;
136+
} else if (process?.frontendApiUrl && process?.frontendApiUrl.length > 0) {
133137
frontendApiUrl = process.frontendApiUrl;
134138
}
135139

0 commit comments

Comments
 (0)