Install following NuGet package in your solution using the NuGet Package Manager in Visual Studio or via command line:
dotnet add package EPiServer.OptimizelyIdentity
In startup.cs
in the ConfigureServices
method, enable Opti ID with following:
services.AddOptimizelyIdentity(useAsDefault: true);
By default, Opti ID is only enabled in shell modules, preview- and edit mode. UseAsDefault
enables Opti ID globally throughout the application. AuthenticationOptions
can be configured when more control is needed over which authentication scheme is active when. The namespace EPiServer.OptimizelyIdentity.OptimizelyIdentityDefaults
contains constants if you need to reference the scheme name while configuring.
Remove any calls to services.AddCmsAspNetIdentity<TUser>()
if ASP.NET Identity is not being used.
Edit and admin mode is accessible on /ui/cms/
.
Run Opti ID locally
Opti ID can be used locally on https://localhost:5000
. For this to work, you also need the settings below, which are provided during the onboarding. The settings are provided automatically when the application is deployed to DXP. In appsettings.json
add following:
{
"EPiServer": {
"Cms": {
"OptimizelyIdentity": {
"InstanceId" : "xxx",
"ClientId" : "xxx",
"ClientSecret" : "xxx"
}
}
}
}