Files
var-monorepo/apps/hub/app/(auth)/oauth/page.tsx
PxlLoewe 9366f8f6b4 Finished Moodle oAuth service
READ Moodle section in README file
2025-02-27 00:32:44 +01:00

46 lines
923 B
TypeScript

import { Authorize } from "./_components/Authorize";
export const services = [
{
id: "1",
service: "dispatch",
name: "Leitstellendisposition",
approvedUrls: ["http://localhost:3001"],
},
{
id: "2",
service: "desktop",
name: "Desktop client",
approvedUrls: ["var"],
},
{
id: "3",
secret: "d0f3e4e4",
service: "moodle",
name: "Moodle",
approvedUrls: [
"http://localhost:8081",
"https://moodle.virtualairrescue.com",
],
},
];
export type Service = (typeof services)[number];
export default async ({
searchParams,
}: {
searchParams: Promise<{ [key: string]: string | string[] | undefined }>;
}) => {
const { service: serviceId, client_id: clientId } = await searchParams;
const service = services.find(
(service) => service.id === serviceId || service.id === clientId,
);
if (!service) {
return <div>Service not found</div>;
}
return <Authorize service={service} />;
};