feat(sso): launch modules through one-time grants
This commit is contained in:
@@ -32,13 +32,6 @@ const Dashboard = () => {
|
||||
try {
|
||||
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) {
|
||||
try {
|
||||
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 {
|
||||
target_url: string;
|
||||
payload: Record<string, any>;
|
||||
headers: Record<string, string>;
|
||||
grant_code: string;
|
||||
redirect_url: string;
|
||||
}
|
||||
|
||||
@@ -23,4 +21,4 @@ export const moduleApi = {
|
||||
|
||||
launchModule: (moduleId: string): Promise<LaunchResponse> =>
|
||||
apiClient.post<LaunchResponse>("/api/sso/initiate", { module_id: moduleId }, { toast: false }),
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user