We Have a PowerShell script that has some code to connect to SharePoint. We were able to run the script successfully and establish a connection to SharePoint. The script performs the below steps:

  1. Gets the ADFS Url using Username from Microsoft Login Service (https://login.microsoftonline.com/GetUserRealm.srf)
  2. gets the SAML Assertion Xml from ADFS url using Username and Password.
  3. Gets the Binary Security Token using SAML Assertion Xml from Microsoft Login Service (https://login.microsoftonline.com/rst2.srf)
  4. gets SPOIDCRL cookie from SharePoint site by passing the binary security token(this SPOIDCRL cookie is enough for reading data).
  5. Gets the form digest from SharePoint Site by passing SPOIDCRL cookie (this digest is required for creating and updating data) (https://sitecollectionurl/_api/contextinfo)
  6. pass the SPOIDCRL cookie to read any data from SharePoint Site.
  7. Pass the Form Digest along with SPOIDCRL cookie to create, update or delete data in SharePoint site.

We are trying to replicate the same steps in Java and we completed the first 2 steps successfully. We are having an authentication issue while executing step 3.

I have compared the SOAP request being sent from PowerShell script and java code but I don’t see any difference except for the UUID changes.

I am attaching the error response from sharepoint in step 3.


10x800488000x80045c17PROD-WST-004.ProdSlices rid:c1133e37-6817-4c4a-912a-ad6eaff3ba00S:Senderwst:FailedAuthenticationAuthentication Failure0x80045C170x80045C17AADSTS50008: SAML token is invalid..

Does anyone know what the issue could be?

If the PowerShell and java soap request are required let me know and I can include them.

  • any feedback on above? – user82782 Apr 23 '19 at 5:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.