none
Authenticate to sharepoint online from non .net platfom RRS feed

  • Question

  • I am following the given article to get the security token by providing the proper credentials for authentication to a SharePoint Online site: http://paulryan.com.au/2014/spo-remote-authentication-rest/ 

    Below is a snippet of the XML request I am sending:

    <s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"
          xmlns:a="http://www.w3.org/2005/08/addressing"
          xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
      <s:Header>
        <a:Action s:mustUnderstand="1">http://schemas.xmlsoap.org/ws/2005/02/trust/RST/Issue</a:Action>
        <a:ReplyTo>
          <a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address>
        </a:ReplyTo>
        <a:To s:mustUnderstand="1">https://login.microsoftonline.com/extSTS.srf</a:To>
        <o:Security s:mustUnderstand="1"
           xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
          <o:UsernameToken>
            <o:Username>[username]</o:Username>
            <o:Password>[password]</o:Password>
          </o:UsernameToken>
        </o:Security>
      </s:Header>
      <s:Body>
        <t:RequestSecurityToken xmlns:t="http://schemas.xmlsoap.org/ws/2005/02/trust">
          <wsp:AppliesTo xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
            <a:EndpointReference>
              <a:Address>[SharePoint Online Site Url]</a:Address>
            </a:EndpointReference>
          </wsp:AppliesTo>
          <t:KeyType>http://schemas.xmlsoap.org/ws/2005/05/identity/NoProofKey</t:KeyType>
          <t:RequestType>http://schemas.xmlsoap.org/ws/2005/02/trust/Issue</t:RequestType>
          <t:TokenType>urn:oasis:names:tc:SAML:1.0:assertion</t:TokenType>
        </t:RequestSecurityToken>
      </s:Body>
    </s:Envelope>

    But the issue I am currently facing is that I always get response which says that the entered and stored passwords do not match.&#x000D;&#x000A. Below is a snippet of the error response I am currently getting. 

    <?xml version="1.0" encoding="utf-8" ?>
    <S:Envelope xmlns:S="http://www.w3.org/2003/05/soap-envelope" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wst="http://schemas.xmlsoap.org/ws/2005/02/trust" xmlns:psf="http://schemas.microsoft.com/Passport/SoapServices/SOAPFault">
        <S:Body>
            <S:Fault>
                <S:Code>
                    <S:Value>S:Sender</S:Value>
                    <S:Subcode>
                        <S:Value>wst:FailedAuthentication</S:Value>
                    </S:Subcode>
                </S:Code>
                <S:Reason>
                    <S:Text xml:lang="en-US">Authentication Failure</S:Text>
                </S:Reason>
                <S:Detail>
                    <psf:error>
                        <psf:value>0x80048821</psf:value>
                        <psf:internalerror>
                            <psf:code>0x80041012</psf:code>
                            <psf:text>The entered and stored passwords do not match.&#x000D;&#x000A;</psf:text>
                        </psf:internalerror>
                    </psf:error>
                </S:Detail>
            </S:Fault>
        </S:Body>
    </S:Envelope>
    Any help from anyone would highly be appreciated.


    Aniket Banerjee

    Wednesday, February 1, 2017 9:41 AM

All replies

  • Hi,

    this approach doesn't work anymore, according with your requirements I suggest to you of using Adal.js a javascript library that handle the authentication with SharePoint Online (Azure AD) please  check this article:

    http://nickvandenheuvel.eu/2016/01/06/authenticate-an-office-365-user-with-adal-js/

    Keep in mind that is also necessary to do the Azure AD configuration to grant your app the access.

    Kind regards, 


    Giuliano De Luca - MCSD SharePoint, MCSD Web Applications, MCPS, MS. www.delucagiuliano.com Twitter: @giuleon Please Mark As Answer if my post solves your problem or Vote As Helpful if the post has been helpful for you.

    Wednesday, February 1, 2017 10:53 AM
  • Hi,

    Is any update for your issue?

    Best Regards,

    Lee


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    Thursday, February 9, 2017 8:49 AM