API
Version 7.x > API > http://localhost/rest/settoken returns error 403 View modes: 
User avatar
Member
Member
poplooukhin-gmail - 12/12/2013 5:01:12 PM
   
http://localhost/rest/settoken returns error 403
Hi all

I tried to authenticate using request to http://localhost/rest/settoken?username=<username>&password=<password>&token=<token>. This request returns error with code 403. I passed valid username and password.

What is the problem?

Thanks

User avatar
Kentico Customer Success
Kentico Customer Success
kentico_martind2 - 12/13/2013 2:36:18 AM
   
RE:http://localhost/rest/settoken returns error 403
Hello,

I would recommend you to search on the Google for "url=https://www.google.com/search?q=rest+authentication+403&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a&channel=fflb]REST authentication 403[/url]"
so you can find articles like this one: HTTP 401 Unauthorized or 403 Forbidden for a “disabled” user?

So it seems that your used is not enabled/allowed to access the website.

Best regards,
Martin Danko

User avatar
Member
Member
poplooukhin-gmail - 12/13/2013 3:07:14 PM
   
RE:http://localhost/rest/settoken returns error 403
Hello, Martin

I tried to invoke the following request using Fiddler:
GET http://localhost:8080/rest/settoken?username=joedoe&password=12345&token=12345
User-Agent: Fiddler
Host: localhost:8080
Content-Type: text/html;charset=utf-8
Authentication: Basic am9lZG9lOjEyMzQ1

But I get following response:
HTTP/1.1 401 Unauthorized
Cache-Control: private
Content-Type: text/html; charset=utf-8
Server: Microsoft-IIS/8.0
Set-Cookie: CMSPreferredCulture=en-US; expires=Sat, 13-Dec-2014 20:58:03 GMT; path=/; HttpOnly
Set-Cookie: ASP.NET_SessionId=bbljwthjctinhsfysnnj4ye5; path=/; HttpOnly
X-AspNet-Version: 4.0.30319
WWW-Authenticate: Basic realm="CMS REST Service"
X-Frame-Options: SAMEORIGIN
X-SourceFiles: =?UTF-8?B?QzpcaW5ldHB1Ylx3d3dyb290XEtlbnRpY29DTVM3XFJFU1RTZXJ2aWNlLnN2Y1xzZXR0b2tlbg==?=
X-Powered-By: ASP.NET
Date: Fri, 13 Dec 2013 20:58:03 GMT
Content-Length: 6036

I enabled REST services in Kentico, I added webhttpbinding and rest service in web.config

Why I get this error?

Thanks for your reply

User avatar
Kentico Customer Success
Kentico Customer Success
kentico_martind2 - 12/19/2013 5:59:46 AM
   
RE:http://localhost/rest/settoken returns error 403
Hi,

Could you please check your settings once again according to the Dev Guide: Configuration for REST as well as Authenticating REST requests it seems that something is wrong with your setup.

Best regards,
Martin Danko