nopSolutions/nopCommerce · error · NopException
Facebook authentication module not configured
Error message
Facebook authentication module not configured
What it means
Thrown by FacebookAuthenticationController.Login as a NopException when either _facebookExternalAuthSettings.ClientKeyIdentifier or ClientSecret is null/empty. It fires after the plugin-active check passes, so the plugin is enabled but its credentials have not been entered.
Source
Thrown at src/Plugins/Nop.Plugin.ExternalAuth.Facebook/Controllers/FacebookAuthenticationController.cs:113
//clear Facebook authentication options cache
_optionsCache.TryRemove(FacebookDefaults.AuthenticationScheme);
_notificationService.SuccessNotification(await _localizationService.GetResourceAsync("Admin.Plugins.Saved"));
return Configure();
}
public async Task<IActionResult> Login(string returnUrl)
{
var store = await _storeContext.GetCurrentStoreAsync();
var methodIsAvailable = await _authenticationPluginManager
.IsPluginActiveAsync(FacebookAuthenticationDefaults.SystemName, await _workContext.GetCurrentCustomerAsync(), store.Id);
if (!methodIsAvailable)
throw new NopException("Facebook authentication module cannot be loaded");
if (string.IsNullOrEmpty(_facebookExternalAuthSettings.ClientKeyIdentifier) ||
string.IsNullOrEmpty(_facebookExternalAuthSettings.ClientSecret))
throw new NopException("Facebook authentication module not configured");
//configure login callback action
var authenticationProperties = new AuthenticationProperties
{
RedirectUri = Url.Action("LoginCallback", "FacebookAuthentication", new { returnUrl = returnUrl })
};
authenticationProperties.SetString(FacebookAuthenticationDefaults.ErrorCallback, Url.RouteUrl(NopRouteNames.General.LOGIN, new { returnUrl }));
return Challenge(authenticationProperties, FacebookDefaults.AuthenticationScheme);
}
public async Task<IActionResult> LoginCallback(string returnUrl)
{
//authenticate Facebook user
var authenticateResult = await HttpContext.AuthenticateAsync(FacebookDefaults.AuthenticationScheme);
if (!authenticateResult.Succeeded || !authenticateResult.Principal.Claims.Any())
return RedirectToRoute(NopRouteNames.General.LOGIN);
View on GitHub (pinned to 64bdf2ff08)
Solutions
- Open the plugin configuration page and enter a valid Facebook App ID and App Secret, then save.
- Confirm the settings are saved for the correct store scope (especially in multi-store setups).
- Create/obtain Facebook app credentials at developers.facebook.com if you do not have them.
Example fix
// before: ClientKeyIdentifier / ClientSecret empty // after: in plugin config save real values settings.ClientKeyIdentifier = "1234567890123456"; settings.ClientSecret = "<app secret from facebook developers console>"; await _settingService.SaveSettingAsync(settings, storeScope);
Defensive patterns
Strategy: validation
Validate before calling
if (string.IsNullOrEmpty(_facebookExternalAuthSettings.ClientKeyIdentifier)
|| string.IsNullOrEmpty(_facebookExternalAuthSettings.ClientSecret))
// redirect admin to plugin config; do not call Login Type guard
static bool IsFacebookConfigured(FacebookExternalAuthSettings s) =>
!string.IsNullOrEmpty(s.ClientKeyIdentifier) && !string.IsNullOrEmpty(s.ClientSecret); Try / catch
try { return await Login(returnUrl); }
catch (NopException ex) when (ex.Message.Contains("not configured"))
{ _notificationService.ErrorNotification("Configure the Facebook plugin."); return RedirectToAction("Configure"); } Prevention
- Add a configuration health check that blocks the login UI until credentials are set.
- Document where to obtain Facebook App ID/Secret.
- Validate settings on save.
When it happens
Trigger: The Facebook auth plugin is active but the admin never saved an App ID (ClientKeyIdentifier) and App Secret (ClientSecret) in its configuration page. Any Login attempt then throws.
Common situations: Freshly enabled plugin without credentials; credentials cleared on save; settings not persisted for the current store scope (multi-store setting mismatch).
Understand the failure class
- Authentication and authorization failures — expired tokens, bad credentials, and missing scopes.
Related errors
- Facebook authentication module cannot be loaded
- Hash validation failed
- Request data is missing
- Part of the request data is missing
- Azure connection string for Blob is not specified
AI-assisted analysis of nopSolutions/nopCommerce@64bdf2ff08 (2026-08-13).
Data as JSON: /api/errors/36f0ce29a4d99ce3.
Report an issue: GitHub.