4.1 SP2 - 401 on Users.svc Web Service Call
Hey everyone!
I'm doing some work with the Sitefinity web services and I've hit a small snag...
Yesterday, I upgraded to SP2. After a successful upgrade, I was unable to connect to the Authenticate service. Instead of the status code I was given before, I'm now greeted by a 401 and the following message:
"Message": "Authentication failed.",
"StackTrace": null,
"ExceptionType": "System.InvalidOperationException"
Hi Tim,
Can you show the code that you use for authentication? Form where you call it and how?
Regards,
Ivan Dimitrov
the Telerik team
Ivan,
I'm doing this in Java, here's the applicable code:
String authPath =
"http://127.0.0.1/Sitefinity/Services/Security/Users.svc/Authenticate"
;
String jsonData = String.format(
"\"MembershipProvider\":\"%s\",\"UserName\":\"%s\",\"Password\":\"%s\",\"Persistent\":%s"
, membershipProvider, userName, password, rememberMe);
HttpPost request =
new
HttpPost(authPath);
HttpClient client =
new
DefaultHttpClient();
HttpResponse httpResponse;
StringEntity se;
try
se =
new
StringEntity(jsonData);
request.setEntity(se);
catch
(UnsupportedEncodingException e1)
e1.printStackTrace();
request.addHeader(
"Content-Type"
,
"application/json"
);
try
httpResponse = client.execute(request);
...
I'm still looking for a solution. Did that help to shed some light on any issues that I'm not seeing?
Looking around on the search engines, I'm seeing people adding things to the web.config. This seems like is a semi-related post from the Telerik forums. (The remote server returned an error: (401) Unauthorized)
I compared the two web.config files after the upgrade and found no apparent changes. Any necessary inclusions to that file would have been done in the upgrade process from SP1 to SP2, yes?
Thanks!
Hello Tim,
Please check this forum post and try the code from it.
Best wishes,
Ivan Dimitrov
the Telerik team
Hi Ivan
Any solution to this?
I'm using the code from this post
www.sitefinity.com/.../sitefinity-4-0-rc-integration-with-silverlight-existing-project.aspx
so it should work OK, but I get a 401 on the line
using (var response = (HttpWebResponse)request.GetResponse())
Hello Ian,
This was resolved in 4.1 SP3.
Kind regards,
Pavel
the Telerik team