diff --git a/BTCPayServer/BTCPayServer.csproj b/BTCPayServer/BTCPayServer.csproj
index 4952b74a0..ae4a356ac 100644
--- a/BTCPayServer/BTCPayServer.csproj
+++ b/BTCPayServer/BTCPayServer.csproj
@@ -211,6 +211,8 @@
$(IncludeRazorContentInPack)
+
+
$(IncludeRazorContentInPack)
diff --git a/BTCPayServer/Hosting/Startup.cs b/BTCPayServer/Hosting/Startup.cs
index 9176bd785..e1fb2b6f8 100644
--- a/BTCPayServer/Hosting/Startup.cs
+++ b/BTCPayServer/Hosting/Startup.cs
@@ -198,7 +198,9 @@ namespace BTCPayServer.Hosting
options.AllowPasswordFlow();
options.AllowAuthorizationCodeFlow();
options.UseRollingTokens();
+#if NETCOREAPP21
options.UseJsonWebTokens();
+#endif
options.RegisterScopes(
OpenIdConnectConstants.Scopes.OpenId,
@@ -212,13 +214,19 @@ namespace BTCPayServer.Hosting
RestAPIPolicies.BTCPayScopes.ViewApps,
RestAPIPolicies.BTCPayScopes.AppManagement
);
-
+#if NETCOREAPP21
options.AddEventHandler();
options.AddEventHandler();
options.AddEventHandler();
options.AddEventHandler();
options.AddEventHandler();
-
+#else
+ options.AddEventHandler(PasswordGrantTypeEventHandler.Descriptor);
+ options.AddEventHandler(AuthorizationCodeGrantTypeEventHandler.Descriptor);
+ options.AddEventHandler(RefreshTokenGrantTypeEventHandler.Descriptor);
+ options.AddEventHandler(ClientCredentialsGrantTypeEventHandler.Descriptor);
+ options.AddEventHandler(LogoutEventHandler.Descriptor);
+#endif
options.ConfigureSigningKey(Configuration);
});
}