1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / General Discussions / jsFiddle my services

jsFiddle my services

2 posts, 0 answered
  1. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    24 Aug 2011
    Link to this post
    Is there (yet?) a way to call my services via jsFiddle by any chance?

    Somehow authenticate on the client side, or anon call the blog service for example?
  2. Dido
    Dido avatar
    149 posts
    Registered:
    24 Sep 2012
    30 Aug 2011
    Link to this post
    Hi Steve,

    Personally, I haven't used this tool yet.

    Try creating a POST request to ~/Sitefinity/Services/Security/Users.svc/Authenticate with POST data in JSON that looks like this:
    {
        "MembershipProvider":"",
        "UserName":"admin",
        "Password":"admin",
        "Persistent":"true"
    }

    Of course, you should change the credentials. If ther service returns 0, then everything is OK.
    // Result Values:
                // 0 = Success, (User was successfully registered as logged in)
                // 1 = UserLimitReached, (The limit of maximum simultaneous logged in users is reached)
                // 2 = UserNotFound, (User not found in any provider)
                // 3 = UserLoggedFromDifferentIp, (User is already logged in from different IP address)
                // 4 = SessionExpired, (Indicates that the user logical session has expired)
                // 5 = UserLoggedOff, (User have the authentication cookie but does not have logged in the database or user is already logged out.)
                // 6 = UserLoggedFromDifferentComputer, (More than one users trying to login from the same IP but from different computers.)
                // 7 = Unknown, (Invalid username or password specified.)
                // 8 = NeedAdminRights, (User is not administrator to logout other users)
                // 9 = UserAlreadyLoggedIn, (User is already logged in from different application or browser)
                // 10 = UserRevoked, (User was revoked. The reason is that the user was deleted or user rights and role membership was changed.)

    If the service returns 3,6, or 9, you should create a request to logout the currently loggied in user in other browser - via a POST request to ~/Sitefinity/Services/Security/Users.svc/LogoutCredentials with the same JSON data.

    Upon successfull login, you should be able to reuse the authentication cookie, and thus call Sitefinity services that require authentiation. Also, note that you might need to use JSONP instead of just JSON.

    Greetings, Dido
    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

2 posts, 0 answered