mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-23 17:55:17 +00:00
fix fcn request
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
ZITADEL_API_URL=http://localhost:22222
|
||||
EMAIL_VERIFICATION=true
|
||||
DEBUG=true
|
||||
NEXT_PUBLIC_BASE_PATH="/"
|
||||
DEBUG=true
|
@@ -80,7 +80,7 @@ export default async function Page(props: { searchParams: Promise<any> }) {
|
||||
});
|
||||
}
|
||||
|
||||
const userResponse = await getUserByID(userId);
|
||||
const userResponse = await getUserByID({ serviceUrl, userId });
|
||||
if (userResponse) {
|
||||
user = userResponse.user;
|
||||
if (user?.type.case === "human") {
|
||||
|
@@ -34,8 +34,12 @@ export async function createServiceForHost<T extends ServiceClass>(
|
||||
token = process.env.ZITADEL_SERVICE_USER_TOKEN;
|
||||
}
|
||||
|
||||
if (!serviceUrl || !token) {
|
||||
throw new Error("No instance url or token found");
|
||||
if (!serviceUrl) {
|
||||
throw new Error("No instance url found");
|
||||
}
|
||||
|
||||
if (!token) {
|
||||
throw new Error("No token found");
|
||||
}
|
||||
|
||||
const transport = createServerTransport(token, {
|
||||
@@ -48,9 +52,10 @@ export async function createServiceForHost<T extends ServiceClass>(
|
||||
export function getServiceUrlFromHeaders(headers: ReadonlyHeaders): string {
|
||||
let instanceUrl: string = process.env.ZITADEL_API_URL;
|
||||
|
||||
const forwardedHost = headers.get("x-zitadel-forward-host");
|
||||
// use the forwarded host if available (multitenant), otherwise fall back to the host of the deployment itself
|
||||
if (headers.get("x-zitadel-forward-host")) {
|
||||
instanceUrl = headers.get("x-zitadel-forward-host") as string;
|
||||
if (forwardedHost) {
|
||||
instanceUrl = forwardedHost;
|
||||
instanceUrl = instanceUrl.startsWith("https://")
|
||||
? instanceUrl
|
||||
: `https://${instanceUrl}`;
|
||||
|
Reference in New Issue
Block a user