4.1 SP2 - 401 on Users.svc Web Service Call

Posted by Community Admin on 04-Aug-2018 14:21

4.1 SP2 - 401 on Users.svc Web Service Call

All Replies

Posted by Community Admin on 06-Jul-2011 00:00

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"

I had everything functioning before the upgrade so I'm confident that the code worked on SP1. Did something change or am I just doin' it wrong? :)

Additional notes:
I've re-checked the configuration against the Sitefinity Installation guide, it seems good.
I'm able to hit the services via browser (after I provide login credentials of course)
The site itself seems to work as expected. I'm able to log in and click around in the admin.

Thanks in advance!

Posted by Community Admin on 06-Jul-2011 00:00

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

Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 06-Jul-2011 00:00

Ivan,

I'm doing this in Java, here's the applicable code:

 
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 appreciate it!

Posted by Community Admin on 07-Jul-2011 00:00

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!

Posted by Community Admin on 07-Jul-2011 00:00

Hello Tim,

Please check this forum post and try the code from it.


Best wishes,
Ivan Dimitrov
the Telerik team

Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 20-Jul-2011 00:00

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())

I'm using an AspNetSqlMembershipProvider, not default.

Thanks

Ian

Posted by Community Admin on 29-Jul-2011 00:00

Hello Ian,

This was resolved in 4.1 SP3.

Kind regards,
Pavel
the Telerik team

Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

This thread is closed