diff --git a/package-lock.json b/package-lock.json index 7790464c..7873319f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,6 +8,7 @@ "name": "assessment-model", "version": "0.1.0", "dependencies": { + "@headlessui/react": "^1.7.14", "@types/node": "20.2.3", "@types/react": "18.2.7", "@types/react-dom": "18.2.4", @@ -98,6 +99,21 @@ "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } }, + "node_modules/@headlessui/react": { + "version": "1.7.14", + "resolved": "https://registry.npmjs.org/@headlessui/react/-/react-1.7.14.tgz", + "integrity": "sha512-znzdq9PG8rkwcu9oQ2FwIy0ZFtP9Z7ycS+BAqJ3R5EIqC/0bJGvhT7193rFf+45i9nnPsYvCQVW4V/bB9Xc+gA==", + "dependencies": { + "client-only": "^0.0.1" + }, + "engines": { + "node": ">=10" + }, + "peerDependencies": { + "react": "^16 || ^17 || ^18", + "react-dom": "^16 || ^17 || ^18" + } + }, "node_modules/@humanwhocodes/config-array": { "version": "0.11.8", "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.8.tgz", diff --git a/package.json b/package.json index a064dc5c..93bcbba5 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "lint": "next lint" }, "dependencies": { + "@headlessui/react": "^1.7.14", "@types/node": "20.2.3", "@types/react": "18.2.7", "@types/react-dom": "18.2.4", diff --git a/src/app/api/auth/[...nextauth]/route.ts b/src/app/api/auth/[...nextauth]/route.ts new file mode 100644 index 00000000..732c6389 --- /dev/null +++ b/src/app/api/auth/[...nextauth]/route.ts @@ -0,0 +1,27 @@ +import NextAuth, { NextAuthOptions } from "next-auth"; +import GoogleProvider from "next-auth/providers/google"; + +const { GOOGLE_CLIENT_ID = "", GOOGLE_CLIENT_SECRET = "" } = process.env; + +export const AuthOptions: NextAuthOptions = { + providers: [ + GoogleProvider({ + clientId: GOOGLE_CLIENT_ID, + clientSecret: GOOGLE_CLIENT_SECRET, + authorization: { + params: { + access_type: "offline", + prompt: "consent", + response_type: "code", + }, + }, + }), + ], + pages: { + signIn: "/", + }, +}; + +const handler = NextAuth(AuthOptions); + +export { handler as GET, handler as POST }; diff --git a/src/app/components/Provider.tsx b/src/app/components/Provider.tsx new file mode 100644 index 00000000..c1e596e5 --- /dev/null +++ b/src/app/components/Provider.tsx @@ -0,0 +1,9 @@ +"use client"; + +import { SessionProvider } from "next-auth/react"; + +const Provider = ({ children }: { children: React.ReactNode }) => { + return {children}; +}; + +export default Provider; diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 872db159..c676aa1f 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -1,5 +1,5 @@ import "./globals.css"; -import Provider from "./components/Provider.tsx"; +import Provider from "./components/Provider"; export const metadata = { title: "",