4

I`m trying to access discovery service from .NET application running on another machine in order to query broker database. But I'm getting the error "Unauthorized request".

Applications app.config file has the following settings:

<add key="discovery-service-uri" value="http://somemachine:8082/discovery.svc" />
<add key="oauth‐enabled" value="true" />
<add key="oauth‐client‐id" value="cduser" />
<add key="oauth‐client‐secret" value="CDUserP@ssw0rd" />

Discovery service and Session Enabled Content service have OAuth Enabled and cduser specified in cd_ambient.conf. All capabilities are registered and updated, and none of the services is on localhost (CIS services run on a different machine than the web application). I tried accessing the discovery service with Fiddler and passed the Bearer token, and everything works ok.

I also checked the discovery service cd_adf.log file and found:

enter image description here

Capabilities listed in cd_storage_conf:

enter image description here

I would appreciate any suggestions and guidance on how access token should be passed in case of using Content Interaction Library.

EDIT: Replied here because the comment section has limited capability...

I was following the instructions on:

https://community.sdl.com/product-groups/sdl-tridion-dx/tridion-sites/b/blog-posts/posts/getting-started-with-content-interaction-library-cil-in-web-8-it-39-s-really-quite-simple

I'm using cduser + oauth set to true and I'm but getting the following:

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

@Velmurugan, Rick, this is what I get in cd_client.log:

 2018-07-05 10:50:58 DEBUG [Sdl.Web.Delivery.DiscoveryService.DiscoveryServiceProvider..ctor] - Attempting to construct discovery-service provider.
2018-07-05 10:50:59 DEBUG [Sdl.Web.Delivery.Service.OAuthTokenProvider..ctor] - Using token-service: http://somemachine:8082/token.svc
2018-07-05 10:50:59 DEBUG [Sdl.Web.Delivery.Service.OAuthTokenProvider.CreateOrRefreshToken] - Attempting to get token from token-service.
2018-07-05 10:50:59 DEBUG [Sdl.Web.Delivery.Service.OAuthTokenProvider.CreateOrRefreshToken] - Failed to get OAuth token from token-service.
2018-07-05 10:50:59 DEBUG [Sdl.Web.Delivery.DiscoveryService.DiscoveryServiceProvider..ctor] - Finished constructing discovery-service provider.
2018-07-05 10:50:59 DEBUG [Sdl.Web.Delivery.Service.OAuthTokenProvider.CreateOrRefreshToken] - Attempting to get token from token-service.
2018-07-05 10:50:59 DEBUG [Sdl.Web.Delivery.Service.OAuthTokenProvider.CreateOrRefreshToken] - Failed to get OAuth token from token-service.
2018-07-05 10:50:59 DEBUG [Sdl.Web.Delivery.Service.Utils.Retry] - Request failed due to authentication exception. Trying again.
2018-07-05 10:50:59 DEBUG [Sdl.Web.Delivery.Service.OAuthTokenProvider.CreateOrRefreshToken] - Attempting to get token from token-service.
2018-07-05 10:50:59 DEBUG [Sdl.Web.Delivery.Service.OAuthTokenProvider.CreateOrRefreshToken] - Failed to get OAuth token from token-service.
2018-07-05 10:50:59 DEBUG [Sdl.Web.Delivery.Service.Utils.Retry] - Request failed due to authentication exception. Trying again.
2018-07-05 10:50:59 DEBUG [Sdl.Web.Delivery.Service.OAuthTokenProvider.CreateOrRefreshToken] - Attempting to get token from token-service.
2018-07-05 10:50:59 DEBUG [Sdl.Web.Delivery.Service.OAuthTokenProvider.CreateOrRefreshToken] - Failed to get OAuth token from token-service.
2018-07-05 10:51:00 DEBUG [Sdl.Web.Delivery.Service.Utils.Retry] - Request failed due to authentication exception. Trying again.
2018-07-05 10:51:00 DEBUG [Sdl.Web.Delivery.Service.OAuthTokenProvider.CreateOrRefreshToken] - Attempting to get token from token-service.
2018-07-05 10:51:00 DEBUG [Sdl.Web.Delivery.Service.OAuthTokenProvider.CreateOrRefreshToken] - Failed to get OAuth token from token-service.
2018-07-05 10:51:00 ERROR [Sdl.Web.Delivery.ContentService.ContentServiceProvider..ctor]
        Problem authenticating with service. Please make sure your authentication settings are correct and you have enabled authentication.
6
  • just to be clear: when you say you access discovery service, you are simply browsing to a specific page url right? what is the error you get on the page itself. do you have other logs from (session) content service? I really would like to see the capabilities you registered in discovery service.
    – ginibeagha
    Jul 2, 2018 at 13:19
  • @ginibeagha I want to query the broker database by using criteria api and cil. I need to access discovery service on somemachine:8082/discovery.svc. I updated the question with the image of registered capabilities.
    – MilanaN
    Jul 2, 2018 at 13:43
  • Looks like an issue in your .NET application side itself, try to enable the DEBUG logs on your .NET application for CIL may be still some dependencies DLLs may be missing in yours .NET library related to CIL
    – Velmurugan
    Jul 2, 2018 at 16:14
  • Try add the following tags in your app.config, <add key="log-level" value="DEBUG"/> <add key="log-rolling" value="true"/> <add key="log-max-log-size" value="50000"/> <add key="log-output" value="c:\\Temp\logs\\cd_client.log"/>
    – Velmurugan
    Jul 2, 2018 at 16:16
  • Please provide the Stack Trace of the exception. Jul 2, 2018 at 17:41

1 Answer 1

4

The error was the symbol '-' in app.config in keys oauth‐client‐id, and oauth‐client‐secret, it's binary representation was not correct.

1
  • Wow, I wouldn’t have come up with that! Indeed, if you look very carefully, you see that the dashes for the oauth keys are a bit shorter than the ones in discovery-service-uri. Jul 5, 2018 at 17:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.