{"record":{"id":"8af7f1f1ce316018","repo":"nopSolutions/nopCommerce","slug":"client-secret-is-not-set","errorCode":null,"errorMessage":"Client secret is not set","messagePattern":"Client secret is not set","errorType":"exception","errorClass":"NopException","httpStatus":null,"severity":"critical","filePath":"src/Plugins/Nop.Plugin.Shipping.UPS/Services/UPSService.cs","lineNumber":118,"sourceCode":"\n    #endregion\n\n    #region Utilities\n\n    /// <summary>\n    /// Get access token\n    /// </summary>\n    /// <returns>The asynchronous task whose result contains access token</returns>\n    private async Task<string> GetAccessTokenAsync()\n    {\n        if (!string.IsNullOrEmpty(_accessToken))\n            return _accessToken;\n\n        if (string.IsNullOrEmpty(_upsSettings.ClientId))\n            throw new NopException(\"Client ID is not set\");\n\n        if (string.IsNullOrEmpty(_upsSettings.ClientSecret))\n            throw new NopException(\"Client secret is not set\");\n\n        var client = new OAuthClient(_httpClientFactory.CreateClient(NopHttpDefaults.DefaultHttpClient), _upsSettings);\n\n        var response = await client.GenerateTokenAsync();\n        _accessToken = response.Access_token;\n\n        return _accessToken;\n    }\n\n    /// <summary>\n    /// Get the weight limit for the selected weight measure\n    /// </summary>\n    /// <returns>\n    /// A task that represents the asynchronous operation\n    /// The task result contains the value\n    /// </returns>\n    private async Task<decimal> GetWeightLimitAsync()\n    {","sourceCodeStart":100,"sourceCodeEnd":136,"githubUrl":"https://github.com/nopSolutions/nopCommerce/blob/64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2/src/Plugins/Nop.Plugin.Shipping.UPS/Services/UPSService.cs#L100-L136","documentation":"Thrown inside GetAccessTokenAsync when the UPS ClientSecret setting is null or empty. The OAuth token exchange with UPS requires both ClientId and ClientSecret. This is the second credential check after ClientId — if ClientId passes but ClientSecret is empty, the token request would fail at the UPS OAuth endpoint.","triggerScenarios":"_upsSettings.ClientSecret is null or empty when GetAccessTokenAsync is called (after the ClientId check already passed) and no cached token exists.","commonSituations":"Only the Client ID was entered but the Client Secret was left blank during configuration; the secret was regenerated on the UPS portal making the stored one invalid (though this would typically produce a different error); copy-paste error where the secret field was skipped.","solutions":["Obtain the Client Secret from the UPS Developer Kit portal alongside the Client ID","Enter the Client Secret at Admin > Configuration > Shipping > UPS > Configure","Verify both Client ID and Client Secret are saved together","If credentials were regenerated on the UPS portal, update both fields in the plugin settings"],"exampleFix":"// before\nvar rates = await _upsService.GetRatesAsync(request);\n\n// after — validate both OAuth credentials before calling\nif (string.IsNullOrEmpty(_upsSettings.ClientId) || string.IsNullOrEmpty(_upsSettings.ClientSecret))\n    throw new InvalidOperationException(\"UPS OAuth credentials are not configured\");\nvar rates = await _upsService.GetRatesAsync(request);","handlingStrategy":"validation","validationCode":"// Validate UPS Client Secret before any shipping operation\nif (string.IsNullOrEmpty(_upsSettings.ClientSecret))\n    throw new InvalidOperationException(\"UPS Client Secret is not configured. Set it in Admin > Shipping > UPS.\");","typeGuard":null,"tryCatchPattern":"// UPS errors throw directly (not wrapped); caller must catch\ntry\n{\n    var rates = await _upsService.GetRatesAsync(request);\n}\ncatch (NopException ex) when (ex.Message.Contains(\"Client secret\"))\n{\n    _logger.Error(\"UPS Client Secret missing — shipping rates unavailable\");\n    return ErrorResult(\"Shipping calculation temporarily unavailable\");\n}","preventionTips":["Enter both Client ID and Client Secret together in the UPS plugin configuration","Obtain both credentials from the same UPS Developer Kit app registration","If credentials are regenerated on the UPS portal, update both fields immediately","Add a configuration validation step that checks both fields are non-empty before saving"],"tags":["ups","oauth","credentials","configuration","shipping","nopcommerce"],"backgroundTag":null,"analyzedSha":"64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2","analyzedAt":"2026-08-13T21:19:38.062Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}