{"record":{"id":"36f0ce29a4d99ce3","repo":"nopSolutions/nopCommerce","slug":"facebook-authentication-module-not-configured","errorCode":null,"errorMessage":"Facebook authentication module not configured","messagePattern":"Facebook authentication module not configured","errorType":"exception","errorClass":"NopException","httpStatus":null,"severity":"error","filePath":"src/Plugins/Nop.Plugin.ExternalAuth.Facebook/Controllers/FacebookAuthenticationController.cs","lineNumber":113,"sourceCode":"        //clear Facebook authentication options cache\n        _optionsCache.TryRemove(FacebookDefaults.AuthenticationScheme);\n\n        _notificationService.SuccessNotification(await _localizationService.GetResourceAsync(\"Admin.Plugins.Saved\"));\n\n        return Configure();\n    }\n\n    public async Task<IActionResult> Login(string returnUrl)\n    {\n        var store = await _storeContext.GetCurrentStoreAsync();\n        var methodIsAvailable = await _authenticationPluginManager\n            .IsPluginActiveAsync(FacebookAuthenticationDefaults.SystemName, await _workContext.GetCurrentCustomerAsync(), store.Id);\n        if (!methodIsAvailable)\n            throw new NopException(\"Facebook authentication module cannot be loaded\");\n\n        if (string.IsNullOrEmpty(_facebookExternalAuthSettings.ClientKeyIdentifier) ||\n            string.IsNullOrEmpty(_facebookExternalAuthSettings.ClientSecret))\n            throw new NopException(\"Facebook authentication module not configured\");\n\n        //configure login callback action\n        var authenticationProperties = new AuthenticationProperties\n        {\n            RedirectUri = Url.Action(\"LoginCallback\", \"FacebookAuthentication\", new { returnUrl = returnUrl })\n        };\n        authenticationProperties.SetString(FacebookAuthenticationDefaults.ErrorCallback, Url.RouteUrl(NopRouteNames.General.LOGIN, new { returnUrl }));\n\n        return Challenge(authenticationProperties, FacebookDefaults.AuthenticationScheme);\n    }\n\n    public async Task<IActionResult> LoginCallback(string returnUrl)\n    {\n        //authenticate Facebook user\n        var authenticateResult = await HttpContext.AuthenticateAsync(FacebookDefaults.AuthenticationScheme);\n        if (!authenticateResult.Succeeded || !authenticateResult.Principal.Claims.Any())\n            return RedirectToRoute(NopRouteNames.General.LOGIN);\n","sourceCodeStart":95,"sourceCodeEnd":131,"githubUrl":"https://github.com/nopSolutions/nopCommerce/blob/64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2/src/Plugins/Nop.Plugin.ExternalAuth.Facebook/Controllers/FacebookAuthenticationController.cs#L95-L131","documentation":"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.","triggerScenarios":"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.","commonSituations":"Freshly enabled plugin without credentials; credentials cleared on save; settings not persisted for the current store scope (multi-store setting mismatch).","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."],"exampleFix":"// before: ClientKeyIdentifier / ClientSecret empty\n// after: in plugin config save real values\nsettings.ClientKeyIdentifier = \"1234567890123456\";\nsettings.ClientSecret = \"<app secret from facebook developers console>\";\nawait _settingService.SaveSettingAsync(settings, storeScope);","handlingStrategy":"validation","validationCode":"if (string.IsNullOrEmpty(_facebookExternalAuthSettings.ClientKeyIdentifier)\n    || string.IsNullOrEmpty(_facebookExternalAuthSettings.ClientSecret))\n    // redirect admin to plugin config; do not call Login","typeGuard":"static bool IsFacebookConfigured(FacebookExternalAuthSettings s) =>\n    !string.IsNullOrEmpty(s.ClientKeyIdentifier) && !string.IsNullOrEmpty(s.ClientSecret);","tryCatchPattern":"try { return await Login(returnUrl); }\ncatch (NopException ex) when (ex.Message.Contains(\"not configured\"))\n{ _notificationService.ErrorNotification(\"Configure the Facebook plugin.\"); return RedirectToAction(\"Configure\"); }","preventionTips":["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."],"tags":["external-auth","plugins","facebook","config","secrets","authentication"],"backgroundTag":null,"analyzedSha":"64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2","analyzedAt":"2026-08-13T21:19:38.062Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}