Forum Discussion

nickz's avatar
nickz
Guide
10 years ago

Authentication issue when performing a REST API call

I'm trying to get data from our company community TKB using REST api. We use SSO and it works fine.

 

I input the url in a browser:

 

http://community.ourcompany.com/ourcompany/restapi/vc/categories/id/ourcompany-tkb/search/messages?q=email&page_size=10&restapi.response_style=view

 

but I got an error response:

 

<response status="error">
<error code="303">
<message>
User -1 does not have the following permission(s) at ourcompany-tkb: [ read_category ]
</message>
</error>
</response>

 

 

If I logged into our website and input the url "http://community.ourcompany.com" in the browser, I could see that the SSO worked and I was identified as a logged user.

 

And then I input the previous url for invoking REST API again, I got all the data I needed successfully.

 

It seems that SSO authentication doesn't work on REST API.

 

What should I do to get the data via REST API if I don't input the url "http://community.ourcompany.com"?

  • OlivierS's avatar
    OlivierS
    Lithium Alumni (Retired)

    nickz 

     

    I've seen the error '303' when I wasn't authenticated.

     

    I would expect you to pass a token in your URL. But I haven't had the chance to play with SSO and the Rest API so can't tell for sure.

     

    Have you reviewed the authentication part of our API documentation? There are steps to take to be able to use the API with SSO ...

    • jchen's avatar
      jchen
      Boss

      Hi OlivierS , I work on the same community as nickz and can verify that the users are granted "Make REST API calls with read access " I believe our community enabled this because of a certain way our KB page was set up. Is there anything else we need to check or try?