THIS IS ARCHIVED DOCUMENTATION
Exception When Trying to Switch Organization
Exception When Trying to Switch Organization
Symptoms
Whether through the Command Center or the Coveo Search section of the Sitecore Control Panel, you’re not able to switch to another cloud organization. Instead, you get the following message in your Sitecore log files:
29116 09:44:53 INFO Could not retrieve license from Coveo cloud.
Exception: Coveo.Framework.Exceptions.CriticalException
Message: ACCESS_DENIED
Source: Coveo.Framework
at Coveo.Framework.Connection.CriticalExceptionHandler.HandleException(HttpClientException p_Exception, String p_Message)
at Coveo.CloudPlatformClientBase.CloudPlatformClient.HandleInvalidTokenError(HttpClientException p_Exception)
at Coveo.CloudPlatformClientBase.CloudPlatformClient.PerformPlatformCallWithErrorHandling(String p_RequestMethod, String p_RequestUri, String p_RequestContent, Boolean p_SkipAccessDeniedValidation)
at Coveo.CloudPlatformClientBase.CloudPlatformClient.GetLicense(String p_OrganizationId)
at Coveo.CloudPlatformClientBase.CloudPlatformClient.GetFullLicense(String p_OrganizationId)
at Coveo.SearchProvider.Licensing.CloudLicenseRetriever.GetCloudLicense()
Nested Exception
Exception: Coveo.Framework.Utils.Rest.HttpClientException
Message: Failed to obtain resource located at '<COVEO_CLOUD_URL>'.
[BEGIN RESPONSE BODY]{"message":"Invalid access token.","errorCode":"INVALID_TOKEN","requestID":"..."}[END RESPONSE BODY]
Source: Coveo.Framework
at Coveo.Framework.Utils.Rest.HttpClient.HandleResponseException(WebException p_Exception, String p_Url, Int64 p_CallId)
at Coveo.Framework.Utils.Rest.HttpClient.ExecuteRequest(String p_Url, Func`2 p_CreateRequest, Int64 p_CallId)
at Coveo.Framework.Utils.Rest.HttpClient.GetRaw(String p_Url)
at Coveo.Framework.Utils.Rest.HttpClient.Get(String p_Url)
at Coveo.CloudPlatformClientBase.CloudPlatformClient.PerformPlatformGetCall(String p_OperationUri)
at Coveo.CloudPlatformClientBase.CloudPlatformClient.PerformPlatformCall(String p_HttpMethod, String p_OperationUri, String p_RequestContent)
at Coveo.CloudPlatformClientBase.CloudPlatformClient.PerformPlatformCallWithErrorHandling(String p_RequestMethod, String p_RequestUri, String p_RequestContent, Boolean p_SkipAccessDeniedValidation)
Nested Exception
Exception: System.Net.WebException
Message: The remote server returned an error: (401) Unauthorized.
Source: System
at System.Net.HttpWebRequest.GetResponse()
at Coveo.Framework.Utils.Rest.HttpClient.ExecuteRequest(String p_Url, Func`2 p_CreateRequest, Int64 p_CallId)
You can also see the following message if the configured API key can’t be properly decrypted:
An error occurred while decrypting the ApiKey configuration element value. The element value will be used as is assuming it's unencrypted.
Cause
This issue occurs when you have an invalid API key in your configuration that isn’t recognized by Coveo Cloud.
Resolution
You need to regenerate a temporary API key in Coveo Cloud to switch organization.
- Create a new API key (see Activating Coveo for Sitecore - Creating the API keys). You don’t need to create a new
SearchApiKey
. - Set this API key directly in the
Coveo.CloudPlatformClient.Custom.config
file, inside theApiKey
node. - Try configuring your organization, as usual.
- Once your organization configured, you can safely delete the API key you created in Coveo Cloud.