| import NextAuth from "next-auth" |
| import KeycloakProvider from "next-auth/providers/keycloak"; |
| |
| let getSecrets = () => { |
| let clientId = process.env.CLIENT_ID; |
| let clientSecret = process.env.CLIENT_SECRET; |
| |
| if (!clientId || !clientSecret) throw new Error("Missing Client Environment Vars"); |
| return {clientId, clientSecret} |
| } |
| |
| export const authOptions = { |
| providers: [ |
| KeycloakProvider(Object.assign(getSecrets(), { |
| issuer: "https://`login.clicks.codes/realms/master" |
| })), |
| ], |
| } |
| |
| |
| const handler = NextAuth(authOptions) |
| |
| export { handler as GET, handler as POST } |