diff --git a/apps/builder/assets/logos/AzureAdLogo.tsx b/apps/builder/assets/logos/AzureAdLogo.tsx
new file mode 100644
index 000000000..667c2c43b
--- /dev/null
+++ b/apps/builder/assets/logos/AzureAdLogo.tsx
@@ -0,0 +1,32 @@
+import { Icon, IconProps } from '@chakra-ui/react'
+
+export const AzureAdLogo = (props: IconProps) => {
+ return (
+
+ {/* */}
+
+
+
+
+
+
+
+ )
+}
diff --git a/apps/builder/assets/logos/index.tsx b/apps/builder/assets/logos/index.tsx
index 454eacdcb..0d7dba95d 100644
--- a/apps/builder/assets/logos/index.tsx
+++ b/apps/builder/assets/logos/index.tsx
@@ -18,3 +18,4 @@ export * from './FacebookLogo'
export * from './ZapierLogo'
export * from './MakeComLogo'
export * from './PabblyConnectLogo'
+export * from './AzureAdLogo'
\ No newline at end of file
diff --git a/apps/builder/components/auth/SocialLoginButtons.tsx b/apps/builder/components/auth/SocialLoginButtons.tsx
index 75ceb0607..60f5dfd71 100644
--- a/apps/builder/components/auth/SocialLoginButtons.tsx
+++ b/apps/builder/components/auth/SocialLoginButtons.tsx
@@ -9,7 +9,7 @@ import {
import { useRouter } from 'next/router'
import React from 'react'
import { stringify } from 'qs'
-import { FacebookLogo, GoogleLogo, GitlabLogo } from 'assets/logos'
+import { FacebookLogo, GoogleLogo, GitlabLogo, AzureAdLogo } from 'assets/logos'
import { BuiltInProviderType } from 'next-auth/providers'
type Props = {
@@ -42,6 +42,11 @@ export const SocialLoginButtons = ({ providers }: Props) => {
callbackUrl: `/typebots?${stringify(query)}`,
})
+ const handleAzureAdClick = async () =>
+ signIn('azure-ad', {
+ callbackUrl: `/typebots?${stringify(query)}`,
+ })
+
return (
{providers?.github && (
@@ -88,6 +93,17 @@ export const SocialLoginButtons = ({ providers }: Props) => {
Continue with {providers.gitlab.name}
)}
+ {providers?.['azure-ad'] && (
+ }
+ onClick={handleAzureAdClick}
+ data-testid='azure-ad'
+ isLoading={['loading', 'authenticated'].includes(status)}
+ variant="outline"
+ >
+ Continue with {providers['azure-ad'].name}
+
+ )}
)
}
diff --git a/apps/builder/pages/api/auth/[...nextauth].ts b/apps/builder/pages/api/auth/[...nextauth].ts
index cff0851c7..07c596049 100644
--- a/apps/builder/pages/api/auth/[...nextauth].ts
+++ b/apps/builder/pages/api/auth/[...nextauth].ts
@@ -4,6 +4,7 @@ import GitHubProvider from 'next-auth/providers/github'
import GitlabProvider from 'next-auth/providers/gitlab'
import GoogleProvider from 'next-auth/providers/google'
import FacebookProvider from 'next-auth/providers/facebook'
+import AzureADProvider from "next-auth/providers/azure-ad";
import prisma from 'libs/prisma'
import { Provider } from 'next-auth/providers'
import { NextApiRequest, NextApiResponse } from 'next'
@@ -79,6 +80,20 @@ if (
)
}
+if (
+ isNotEmpty(process.env.AZURE_AD_CLIENT_ID) &&
+ isNotEmpty(process.env.AZURE_AD_CLIENT_SECRET) &&
+ isNotEmpty(process.env.AZURE_AD_TENANT_ID)
+) {
+ providers.push(
+ AzureADProvider({
+ clientId: process.env.AZURE_AD_CLIENT_ID,
+ clientSecret: process.env.AZURE_AD_CLIENT_SECRET,
+ tenantId: process.env.AZURE_AD_TENANT_ID,
+ }),
+ )
+}
+
const handler = (req: NextApiRequest, res: NextApiResponse) => {
if (req.method === 'HEAD') {
res.status(200)