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