providers/azure-ad-b2c
default()β
Add Azure AD B2C login to your page.
Configurationβ
Basicβ
Basic configuration sets up Azure AD B2C to return an ID Token. This should be done as a prerequisite prior to running through the Advanced configuration.
For the step "User attributes and token claims" set the following:
- Collect attribute:
- Email Address
- Display Name
- Given Name
- Surname
- Return claim:
- Email Addresses
- Display Name
- Given Name
- Surname
- Identity Provider
- Identity Provider Access Token
- User's Object ID
Exampleβ
import { Auth } from "@auth/core";
import AzureADB2C from "@auth/core/providers/azure-ad-b2c";
const request = new Request("https://example.com");
const response = await AuthHandler(request, {
// optionally, you can pass `tenantId` and `primaryUserFlow` instead of `issuer`
providers: [AzureADB2C({ clientId: "", clientSecret: "", issuer: "" })],
});
Resourcesβ
Notesβ
By default, Auth.js assumes that the Azure AD B2C provider is based on the OIDC specification.
The Azure AD B2C provider comes with a default configuration. To override the defaults for your use case, check out customizing a built-in OAuth provider.
If you think you found a bug in the default configuration, you can open an issue.
Auth.js strictly adheres to the specification and it cannot take responsibility for any deviation from the spec by the provider. You can open an issue, but if the problem is non-compliance with the spec, we might not pursue a resolution. You can ask for more help in Discussions.
default(
options
:OIDCUserConfig
<AzureADB2CProfile
> & {primaryUserFlow
?:string
;tenantId
?:string
;}):OIDCConfig
<AzureADB2CProfile
>
Parametersβ
Parameter | Type |
---|---|
options | OIDCUserConfig <AzureADB2CProfile > & {primaryUserFlow ?: string ;tenantId ?: string ;} |