Skip to content

Commit

Permalink
feat: add Azure AD Login for UI
Browse files Browse the repository at this point in the history
  • Loading branch information
georgeherby committed Mar 11, 2024
1 parent 3664de2 commit 5c5d2fb
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ It is built using Next.js, Node.js 20, Typescript and MongoDB Atlas.
- Ingests trace data from Langchain/Langsmith
- Handles feedback creation and updating
- UI to view trace data
- UI authentication providers (Github, Microsoft AD)
- MongoDB Trigger to add token usage data to the trace data

### Limitations
Expand Down
5 changes: 5 additions & 0 deletions packages/ui/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,8 @@ NEXTAUTH_ENABLE=false
#NEXTAUTH_GITHUB_ID=
#NEXTAUTH_GITHUB_SECRET=
#NEXTAUTH_GITHUB_ORGANISATION=

# Azure AD/Entra
#NEXTAUTH_AZURE_AD_CLIENT_ID=
#NEXTAUTH_AZURE_AD_CLIENT_SECRET=
#NEXTAUTH_AZURE_AD_TENANT_ID=
2 changes: 1 addition & 1 deletion packages/ui/src/app/api/auth/[...nextauth]/route.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { authOptions } from '@/lib/utils/auth-options';
import NextAuth from 'next-auth';

const handler = NextAuth( authOptions);
const handler = NextAuth(authOptions);
export { handler as GET, handler as POST };
6 changes: 6 additions & 0 deletions packages/ui/src/lib/utils/auth-options.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { NextAuthOptions } from 'next-auth';
import GithubProvider from 'next-auth/providers/github';
import AzureADProvider from 'next-auth/providers/azure-ad';

export const authOptions: NextAuthOptions = {
providers: [
Expand All @@ -12,5 +13,10 @@ export const authOptions: NextAuthOptions = {
},
},
}),
AzureADProvider({
clientId: process.env.NEXTAUTH_AZURE_AD_CLIENT_ID!,
clientSecret: process.env.NEXTAUTH_AZURE_AD_CLIENT_SECRET!,
tenantId: process.env.NEXTAUTH_AZURE_AD_TENANT_ID,
}),
],
};

0 comments on commit 5c5d2fb

Please sign in to comment.