Add next-auth, direnv|flake.nix|.env.

Change-Id: I897a15f48ac61addfa27ca3d95e6c4849e73125a
Reviewed-on: https://git.clicks.codes/c/Caramels/Lotting/+/342
Tested-by: Samuel Shuert <coded@clicks.codes>
Reviewed-by: Samuel Shuert <coded@clicks.codes>
diff --git "a/app/api/auth/\133...nextauth\135/route.ts" "b/app/api/auth/\133...nextauth\135/route.ts"
new file mode 100644
index 0000000..c3268de
--- /dev/null
+++ "b/app/api/auth/\133...nextauth\135/route.ts"
@@ -0,0 +1,23 @@
+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 }
\ No newline at end of file