2

I am developing external component in Sitecore Content Hub 4.X. I want to call REST API as a current logged user. Custom component expose some options, for example options.api but it is only text...

https://docs.stylelabs.com/content/4.0.x/integrations/integration-components/external-page-component/external-page-options.html?redirect=true

but how to call for example options.api.entities using credentials of already logged user?

6

The call will be authenticated based on the Content Hub cookies you have. So it will use the logged in user to make the call.

You can use jQuery to make the call, the library is already loaded.

$.ajax({
   url: `${options.api.entities.href}&skip=0&take=10`,
   contentType: 'application/json',
   type: 'get',
   success: (data) => {
      callback(data);
   }
});
2
  • this works for get, but doesn't for post :/ I am api user and I assigned myself to all groups and still 403 is returned. May 21 at 8:11
  • you will need X-Auth-Token in header for POST
    – josedbaez
    Jul 7 at 8:13

Your Answer

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

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