Prompt for site authentication in GetGroupCollectionFromUser

Sep 5, 2013 at 2:40 PM
I am working in a SharePoint 2010 site that requires Common Access Card (CAC) authentication.

I am using SPServices GetGroupCollectionFromUser to determine if the current user belongs to a SP Group and then configuring the view where Target Audience is not applicable. It works fine except that the user is prompted for authentication even after they have authenticated into the site. Removing the call to GetGroupCollectionFromUser eliminates the authentication prompt.

Why is it prompting for authentication again? Has anyone seen this happen?

Here is my code:
//get user's group
    operation: "GetGroupCollectionFromUser",
    userLoginName: $().SPServices.SPGetCurrentUser(),
    async: false,
    completefunc: function(xData, status){
            if(status == "success"){
                var groupName = $(this).attr('Name');
                if(groupName == "SomeGroupName")
                    //Do something;
Sep 5, 2013 at 11:05 PM
I've narrowed it down to the SPServices.SPGetCurrentUser function, but still don't know why it prompts for authentication.
Sep 6, 2013 at 1:17 PM
Authentication can get in the way of things. Basically, if the user can do the task through the UI, they should be able to do it via the Web Services.

As noted in the docs, SPGetCurrentUser loads the _layouts/userdisp.aspx page and grabs the values from there. Depending on what you need, there are other methods in 2010 and 2013, as there are some existing JavaScript variables.