Quantcast
Channel: Developing Apps for SharePoint 2013 forum
Viewing all articles
Browse latest Browse all 8089

SharePoint Hosted App - Client App Part Authentication

$
0
0

I developed a Share Point hosted client app part which I've added to a site collection.  I'm having no problems with authentication when I initially launch site collection as workstation user (i.e. windows user account currently logged into workstation).  The problem I'm trying to get past is when I use the http://sharepointurl/site/sitecollection/_layouts/closeConnection.aspx?loginasanotheruser=true to login as another user.  It looks like the host web (site collection) is the only session / context that starts running under account I logged in with when prompted for new credentials when running closeConnection.aspx.  All client app parts that are on this page still continue to run under the workstation user. 

I have specific requirements that require ability to prompt user for login, and more importantly need the ability to access host web user login ID within client app part. I don't necessarily need app part to run under any specific identity, I just need to know login name hostweb running under.

Here's how I'm getting login name within client app part code (JSOM):

## within App.js file

var context = SP.ClientContext.get_current();

var user = context.get_web().get_currentUser();

## within document ready function

context.load(user);

context.executeQueryAsync(onGetUserNameSuccess, onGetUserNameFail);

function onGetUserNameSuccess(){

##this is where my problem is. The statement below doesn't seem to update based on new user logged in on hostweb when using closeConnection.aspx

user.get_title();

}

I'm new to SharePoint development so I apologize in advance if I'm vague or missing critical details in explanation above.

I'd appreciate any suggestions or guidance on how to accomplish my goal.

Thanks,

Luis


Viewing all articles
Browse latest Browse all 8089

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>