none
SP Online - Login to Sharepoint With External Users by Javascript

    Question

  • Hi!

    In the past few days i'been struggling to create a javascript that allows me to authenticate External Users (e.g. a hotmail account) to Sharepoint. Of course first i have shared the site to that external user.

    I have a code in Javascript with which i can authenticate normal Sharepoint users and works fine, it's something like this:

    	function login(userID, password, url, successBlock, failBlock){
    		$.ajax({ 
    			url: 'https://login.microsoftonline.com/extSTS.srf', 
    			dataType: 'text', 
    			type: 'POST',
    			data: getSAMLRequest(userID, password, url), 
    			headers: {
    				Accept : "application/soap+xml; charset=utf-8" 
    				}, 
    			success: function(result, textStatus, jqXHR) {
    						var xmlDoc = $.parseXML(result); 
    						var xml = $(xmlDoc)
    						var securityToken = xml.find("BinarySecurityToken").text(); 

    But when i tried to use it with a hotmail account (with which i can access Sharepoint via browser as external user), it fails. The STS returns this error:

    Direct login to WLID is not allowed for this federated namespace

    I tried some alternatives like use this url instead: "https://login.live-int.com/extSTS.srf". But no luck (that url i believe it retrieves some CERT error or something).

    Could someone point me into the right direction?

    Regards,

    Andres Nebel


    Thursday, March 3, 2016 2:34 PM