forked from nextauthjs/next-auth
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(provider): Add Azure Active Directory B2C (nextauthjs#809)
* add provider: Microsoft * documentation * support no tenant setup * fix code style * chore: rename Microsoft provider to AzureADB2C * chore: alphabetical order in providers/index
- Loading branch information
1 parent
6f067be
commit 6e6a24a
Showing
6 changed files
with
57 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
export default (options) => { | ||
const tenant = options.tenantId ? options.tenantId : 'common' | ||
|
||
return { | ||
id: 'azure-ad-b2c', | ||
name: 'Azure Active Directory B2C', | ||
type: 'oauth', | ||
version: '2.0', | ||
params: { | ||
grant_type: 'authorization_code' | ||
}, | ||
accessTokenUrl: `https://login.microsoftonline.com/${tenant}/oauth2/v2.0/token`, | ||
authorizationUrl: `https://login.microsoftonline.com/${tenant}/oauth2/v2.0/authorize?response_type=code&response_mode=query`, | ||
profileUrl: 'https://graph.microsoft.com/v1.0/me/', | ||
profile: (profile) => { | ||
return { | ||
id: profile.id, | ||
name: profile.displayName, | ||
email: profile.userPrincipalName | ||
} | ||
}, | ||
...options | ||
} | ||
} |
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
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,28 @@ | ||
--- | ||
id: azure-ad-b2c | ||
title: Azure Active Directory B2C | ||
--- | ||
|
||
## Documentation | ||
|
||
https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-auth-code-flow | ||
|
||
## Configuration | ||
|
||
https://docs.microsoft.com/en-us/azure/active-directory-b2c/tutorial-create-tenant | ||
|
||
## Example | ||
|
||
```js | ||
import Providers from 'next-auth/providers'; | ||
... | ||
providers: [ | ||
Providers.AzureADB2C({ | ||
clientId: process.env.AZURE_CLIENT_ID, | ||
clientSecret: process.env.AZURE_CLIENT_SECRET, | ||
scope: 'offline_access User.Read', | ||
tenantId: process.env.AZURE_TENANT_ID, | ||
}), | ||
] | ||
... | ||
``` |
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