How to solve the error The remote server returned an error: (401) Unauthorized.

Modified on Fri, 24 Jan at 1:00 PM

FIRST CREATED ON 24 Jan 2025  I  AUTHOR Emma Camacho

If you encounter an ' The remote server returned an error: (401) Unauthorized. ' error in Mail & Deploy and the Datasource affected is a Qlik Sense SaaS App, it indicates that there is a problem with the authorization.



Issue:


STACK TRACE

WebSocketException: Unable to connect to the remote server

at MailAndDeploy.Server.ExtensionMethods.Await(Task pTask, TimeSpan pTimeout)

at MailAndDeploy.Server.Json.Rpc.JsonRpcConnection..ctor(Uri pUri, JsonRpcCookie[] pCookies, JsonRpcHeader[] pHeaders)

at MailAndDeploy.Server.Connectors.QlikSense.QsSaasConnector.EstablishRpcConnection(Uri pUri, JsonRpcCookie[] pCookies, JsonRpcHeader[] pHeaders)

at MailAndDeploy.Server.Connectors.QlikSense.QsSaasConnector.EstablishRpcConnection(String pAppId, String& pEngineSessionId)

at MailAndDeploy.Server.Connectors.QlikSense.Model.QsApp.EstablishRpcConnection()

at MailAndDeploy.Server.Connectors.QlikSense.Model.QsApp..ctor(QsConnector pConnector, String pAppId)

at MailAndDeploy.Server.Connectors.QlikSense.QsConnector.OpenApp(QlikSenseAppDatasource pDatasource, UserIdentity pIdentity)

at MailAndDeploy.Server.Persistency.Entities.Datasource.RebuildCache()

at MailAndDeploy.Server.Services.Management.Ui.DatasourcesSheet.ListPage_EntitiesTable_CellButtonClicked(String pSender, String pData)

WebException: The remote server returned an error: (401) Unauthorized.

at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)

at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)

--- End of stack trace from previous location where exception was thrown ---

at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

at System.Net.WebSockets.ClientWebSocket.d__21.MoveNext()



Resolution


Check that the API Key is not expired and if so, create a new API Key and update this property in all the Qlik Sense SaaS Datasources with the new one.



Looking for Additional Guidance?


If you require more detailed information or further assistance, please visit our comprehensive Online Documentation. Our resources are designed to help you navigate all features and functionalities effectively.

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article