2023-04-20 12:55:39 +02:00
|
|
|
import { ZitadelOptions } from "@zitadel/server";
|
|
|
|
|
import { getAuth } from "@zitadel/server/auth";
|
|
|
|
|
|
|
|
|
|
import { getApp, getApps, initializeApp } from "@zitadel/server/app";
|
2023-04-13 13:26:02 +02:00
|
|
|
|
|
|
|
|
export const zitadelConfig: ZitadelOptions = {
|
|
|
|
|
apiUrl: process.env.ZITADEL_API_URL ?? "",
|
|
|
|
|
projectId: process.env.ZITADEL_PROJECT_ID ?? "",
|
|
|
|
|
appId: process.env.ZITADEL_APP_ID ?? "",
|
|
|
|
|
token: "this should be a pat",
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if (!getApps().length) {
|
|
|
|
|
initializeApp(zitadelConfig);
|
|
|
|
|
}
|
|
|
|
|
|
2023-04-20 12:55:39 +02:00
|
|
|
const app = getApp();
|
|
|
|
|
|
|
|
|
|
export async function getMyUser(): Promise<GetMyUserResponse> {
|
|
|
|
|
const auth = await getAuth();
|
|
|
|
|
const response = await auth.getMyUser({});
|
|
|
|
|
return response;
|
|
|
|
|
}
|