Skip to content

Commit

Permalink
feat(auth): refactor authentication setup and update next-auth to v5.…
Browse files Browse the repository at this point in the history
…0.0-beta.25
  • Loading branch information
C4illin committed Dec 9, 2024
1 parent 5b5dbc7 commit 304b080
Show file tree
Hide file tree
Showing 5 changed files with 95 additions and 121 deletions.
8 changes: 2 additions & 6 deletions app/api/auth/[...nextauth]/route.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,2 @@
import NextAuth from "next-auth";
import {authOptions} from "@/app/lib/auth";

const handler = NextAuth(authOptions);

export { handler as GET, handler as POST };
import { handlers } from "@/auth"
export const { GET, POST } = handlers
2 changes: 1 addition & 1 deletion app/games/page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { auth } from "@/app/lib/auth";
import { auth } from "@/auth";
import type { Route } from "next";
import Link from "next/link";
import { redirect } from "next/navigation";
Expand Down
21 changes: 21 additions & 0 deletions auth.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import NextAuth from "next-auth";
import BoxyHQ from "next-auth/providers/boxyhq-saml";
import MicrosoftEntraID from "next-auth/providers/microsoft-entra-id";

// For more information on each option (and a full list of options) go to
// https://next-auth.js.org/configuration/options

export const { auth, handlers, signIn, signOut } = NextAuth({
providers: [
BoxyHQ({
issuer: process.env.AUTH_BOXYHQ_SAML_ISSUER,
clientId: process.env.AUTH_BOXYHQ_SAML_ID || "dummy",
clientSecret: process.env.AUTH_BOXYHQ_SAML_SECRET || "dummy",
}),
MicrosoftEntraID({
clientId: process.env.AUTH_MICROSOFT_ENTRA_ID_ID || "dummy",
clientSecret: process.env.AUTH_MICROSOFT_ENTRA_ID_SECRET,
issuer: process.env.AUTH_MICROSOFT_ENTRA_ID_ISSUER,
})
],
});
183 changes: 70 additions & 113 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"clsx": "^2.1.1",
"drizzle-orm": "^0.37.0",
"next": "15.0.4",
"next-auth": "^4.24.10",
"next-auth": "^5.0.0-beta.25",
"react": "^18",
"react-dom": "^18",
"react-hot-toast": "^2.4.1",
Expand Down

0 comments on commit 304b080

Please sign in to comment.