-
-
Notifications
You must be signed in to change notification settings - Fork 10.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ feat: support microsoft-entra-id sso login
- Loading branch information
Showing
3 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import MicrosoftEntraID from 'next-auth/providers/microsoft-entra-id'; | ||
|
||
import { authEnv } from '@/config/auth'; | ||
|
||
import { CommonProviderConfig } from './sso.config'; | ||
|
||
const provider = { | ||
id: 'microsoft-entra-id', | ||
provider: MicrosoftEntraID({ | ||
...CommonProviderConfig, | ||
// Specify auth scope, at least include 'openid email' | ||
// all scopes in Azure AD ref: https://learn.microsoft.com/en-us/entra/identity-platform/scopes-oidc#openid-connect-scopes | ||
authorization: { params: { scope: 'openid email profile' } }, | ||
// TODO(NextAuth ENVs Migration): Remove once nextauth envs migration time end | ||
clientId: authEnv.MICROSOFT_ENTRA_ID_ID ?? process.env.AUTH_MICROSOFT_ENTRA_ID_ID, | ||
clientSecret: authEnv.MICROSOFT_ENTRA_ID_SECRET ?? process.env.AUTH_MICROSOFT_ENTRA_ID_SECRET, | ||
tenantId: authEnv.MICROSOFT_ENTRA_ID_TENANT_ID ?? process.env.AUTH_MICROSOFT_ENTRA_ID_TENANT_ID, | ||
// Remove end | ||
// TODO(NextAuth): map unique user id to `providerAccountId` field | ||
// profile(profile) { | ||
// return { | ||
// email: profile.email, | ||
// image: profile.picture, | ||
// name: profile.name, | ||
// providerAccountId: profile.user_id, | ||
// id: profile.user_id, | ||
// }; | ||
// }, | ||
}), | ||
}; | ||
|
||
export default provider; |