Skip to content

Commit

Permalink
fix keycloak url
Browse files Browse the repository at this point in the history
  • Loading branch information
chaoran-chen committed Dec 4, 2024
1 parent 3c51ce0 commit 92e445b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
3 changes: 2 additions & 1 deletion website/src/pages/api-documentation/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ import { authenticationApiDocsUrl } from './authenticationApiDocsUrl';
import { getRuntimeConfig, getWebsiteConfig } from '../../config';
import BaseLayout from '../../layouts/BaseLayout.astro';
import { routes } from '../../routes/routes.ts';
import { getAuthBaseUrl } from '../../utils/getAuthUrl';
const clientConfig = getRuntimeConfig().public;
const keycloakUrl = getRuntimeConfig().serverSide.keycloakUrl;
const keycloakUrl = getAuthBaseUrl();
const websiteConfig = getWebsiteConfig();
Expand Down
9 changes: 9 additions & 0 deletions website/src/utils/getAuthUrl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,12 @@ export const getAuthUrl = async (redirectUrl: string) => {
});
return authUrl;
};

export const getAuthBaseUrl = async () => {
const authUrl = await getAuthUrl('/');
const index = authUrl.indexOf('/realms');
if (index === -1) {
return null;
}
return authUrl.substring(0, index);
};

0 comments on commit 92e445b

Please sign in to comment.