feat(sso): launch modules through one-time grants

This commit is contained in:
Inamul-hasan-tec
2026-09-01 11:21:54 +05:30
parent 4bf09862c8
commit 8637e0ad3c
2 changed files with 3 additions and 12 deletions
+1 -8
View File
@@ -32,13 +32,6 @@ const Dashboard = () => {
try { try {
const response = await moduleApi.launchModule(moduleId); const response = await moduleApi.launchModule(moduleId);
await fetch(response.target_url, {
method: "POST",
headers: { "Content-Type": "application/json", ...response.headers },
body: JSON.stringify(response.payload),
credentials: "include",
});
if (response.redirect_url) { if (response.redirect_url) {
try { try {
const url = new URL(response.redirect_url); const url = new URL(response.redirect_url);
@@ -202,4 +195,4 @@ const Dashboard = () => {
); );
}; };
export default Dashboard; export default Dashboard;
@@ -11,9 +11,7 @@ export interface Module {
} }
export interface LaunchResponse { export interface LaunchResponse {
target_url: string; grant_code: string;
payload: Record<string, any>;
headers: Record<string, string>;
redirect_url: string; redirect_url: string;
} }
@@ -23,4 +21,4 @@ export const moduleApi = {
launchModule: (moduleId: string): Promise<LaunchResponse> => launchModule: (moduleId: string): Promise<LaunchResponse> =>
apiClient.post<LaunchResponse>("/api/sso/initiate", { module_id: moduleId }, { toast: false }), apiClient.post<LaunchResponse>("/api/sso/initiate", { module_id: moduleId }, { toast: false }),
}; };