From 345cfc670a54fa0f1f8ec81ffddf39ded0599f31 Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Tue, 10 Sep 2024 17:16:17 +0100 Subject: [PATCH] temp test --- src/app/api/auth/[...nextauth]/route.ts | 15 +++++++++++++++ .../components/signin/MicrosoftSignInButton.jsx | 3 ++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/app/api/auth/[...nextauth]/route.ts b/src/app/api/auth/[...nextauth]/route.ts index e7cee25..6f5e5a6 100644 --- a/src/app/api/auth/[...nextauth]/route.ts +++ b/src/app/api/auth/[...nextauth]/route.ts @@ -4,6 +4,7 @@ import AzureADB2CProvider from "next-auth/providers/azure-ad-b2c"; import { db } from "@/app/db/db"; import { user as userTable, User } from "@/app/db/schema/users"; import { eq } from "drizzle-orm"; +import AzureADProvider from "next-auth/providers/azure-ad"; const { GOOGLE_CLIENT_ID = "", GOOGLE_CLIENT_SECRET = "" } = process.env; const { @@ -11,6 +12,9 @@ const { AZURE_AD_B2C_CLIENT_ID = "", AZURE_AD_B2C_CLIENT_SECRET = "", AZURE_AD_B2C_PRIMARY_USER_FLOW = "", + AZURE_AD_B2B_CLIENT_ID = "", + AZURE_AD_B2B_CLIENT_SECRET = "", + AZURE_AD_B2B_TENANT_ID = "", } = process.env; type OauthProvider = "google"; @@ -45,6 +49,17 @@ export const AuthOptions: NextAuthOptions = { }, }, }), + AzureADProvider({ + clientId: AZURE_AD_B2B_CLIENT_ID, + clientSecret: AZURE_AD_B2B_CLIENT_SECRET, + tenantId: AZURE_AD_B2B_TENANT_ID, + authorization: { + params: { + scope: "openid profile email", + prompt: "login", + }, + }, + }), ], pages: { signIn: "/", diff --git a/src/app/components/signin/MicrosoftSignInButton.jsx b/src/app/components/signin/MicrosoftSignInButton.jsx index f53399f..e154954 100644 --- a/src/app/components/signin/MicrosoftSignInButton.jsx +++ b/src/app/components/signin/MicrosoftSignInButton.jsx @@ -13,7 +13,8 @@ const MicrosoftSignInButton = () => {