2

I am getting below error while running the DXA application:

Unauthorized Request -- Please check your configuration settings to make sure your authentication details are correct.

I have gone through several questions (one of sample question) having same issue and cross checked the config details provided in those solutions. But still I am getting this error. Below is my settings in web.config:

<add key="discovery-serviceuri"value="http://localhost:8082/discovery.svc"/>    
<add key="cid-service-proxy-pattern" value="/cid*" />
<add key="cid-localhost" value="localhost" />
<add key="log-level" value="INFO" />
<add key="log-rolling" value="true" />
<add key="log-max-log-size" value="50000" />
<add key="log-output" value="C:\temp\logs\cd_client_Test.log" />
<add key="oauth-enabled" value="true" />
<add key="oauth-client-id" value="cduser" />

Stack Trace:

[AuthenticationException: Unauthorized Request -- Please check your configuration settings to make sure your authentication details are correct.] Sdl.Web.Delivery.Service.Utils.PerformRetry(Func1 block, Int32 retryCount) +113 Sdl.Web.Delivery.Service.Utils.Retry(Func1 block, Int32 retryCount, Boolean locking) +205
Sdl.Web.Delivery.Service.ODataV4Service.Execute(ODataV4ClientFunction function) +178
Sdl.Web.Delivery.ContentService.ContentServiceClient.Execute(ODataV4ClientFunction function) +60
Sdl.Web.Delivery.Dynamic.DynamicMappingsRetrieverImpl.GetPublicationMapping(String url) +178
Tridion.ContentDelivery.DynamicContent.DynamicMappingsRetriever.GetPublicationMapping(String url) +64
Sdl.Web.Tridion.CdApiLocalizationResolver.ResolveLocalization(Uri url) in C:\Jenkins\workspace\DXA Dev CI Web App .NET\Sdl.Web.Tridion\CdApiLocalizationResolver.cs:64
Sdl.Web.Mvc.Configuration.WebRequestContext.GetCurrentLocalization() in C:\Jenkins\workspace\DXA Dev CI Web App .NET\Sdl.Web.Mvc\Configuration\WebRequestContext.cs:214
Sdl.Web.Mvc.Configuration.WebRequestContext.get_Localization() in C:\Jenkins\workspace\DXA Dev CI Web App .NET\Sdl.Web.Mvc\Configuration\WebRequestContext.cs:25
Sdl.Web.Mvc.Statics.StaticContentModule.BeginRequest(Object sender, EventArgs e) in C:\Jenkins\workspace\DXA Dev CI Web App .NET\Sdl.Web.Mvc\Statics\StaticContentModule.cs:81
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +141 System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +48 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +71

Kindly point me if I am missing something?
Update
Got the below Trace from the log file:

2018-04-12 15:20:19 DEBUG [Sdl.Web.Delivery.ADF.HttpModule..cctor] - Ambient Data context initialization. 2018-04-12 15:20:21 DEBUG [Sdl.Web.Delivery.DiscoveryService.DiscoveryServiceProvider..ctor] - Attempting to construct discovery-service provider.
2018-04-12 15:20:21 TRACE [Sdl.Web.Delivery.DiscoveryService.DiscoveryServiceClient..ctor] Registering OData V2 Service: http://server:port/discovery.svc/
2018-04-12 15:20:21 TRACE [Microsoft.OData.Client.DataServiceContext.FireSendingRequest2] OData V4 Service Request: http://server:port/discovery.svc/TokenServiceCapabilities?$top=1 (GET) OData-Version:4.0 OData-MaxVersion:4.0 Accept:application/json;odata.metadata=minimal Accept-Charset:UTF-8 User-Agent:Microsoft ADO.NET Data Services
2018-04-12 15:20:23 DEBUG [Sdl.Web.Delivery.Service.OAuthTokenProvider..ctor] - Using token-service: http://serverIP:port/token.svc 2018-04-12 15:20:23 DEBUG [Sdl.Web.Delivery.Service.OAuthTokenProvider.CreateOrRefreshToken] - Attempting to get token from token-service. 2018-04-12 15:20:24 TRACE [Sdl.Web.Delivery.OAuthClient.AuthenticationClient.ProcessRequest] Token service response: Proxy Authorization Required

Proxy Authorization Required


Description: Authorization is required for access to this proxy
2018-04-12 15:20:36 ERROR [Sdl.Web.Delivery.ContentService.ContentServiceProvider..ctor] Problem authenticating with service. Please make sure your authentication settings are correct and you have enabled authentication.

  • 1
    Sounds like a mismatch in your oauth security settings, note that in the web.config you are showing you exposed the default credentials (I would suggest never to expose credentials and passwords in a public question like this, not even the default one), is that the same ones that you have on the Content Delivery services? – Bart Koopman Apr 12 '18 at 9:43
  • 1. Is that content service/discovery service enabled OAuth authentication? 2. Is it registered correctly with discovery correctly with correct OAuth credentials? 3. double check your credentials on this file discovery\config\cd_ambient_conf.xml? – Velmurugan Apr 12 '18 at 9:46
  • @BartKoopman, i removed the credentials from question, thanks for pointing it out. Yes that is the same as i have in Content Delivery. – SDLBeginner Apr 12 '18 at 10:03
  • @Velmurugan, I checked the credentials on the cd_ambient_config.xml and found its correct.Checked Discovery service and it's enabled. – SDLBeginner Apr 12 '18 at 10:24
  • Using postman to check the athentication with discovery service from webapp server – Velmurugan Apr 12 '18 at 12:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.