Forum Discussion

prashantguptag's avatar
prashantguptag
Brass Contributor
Sep 26, 2017

SharePoint Online Remote Authentication

Hello,

 

I need to create SharePoint list items remotely via some client component (as of now with Postman) and as soon as list item is created, a workflow which is associated into the list should trigger automatically.

 

1. First option I tried to register an add-in to get the client id and secret and then calling the endpoints under app only context to create the list item. But the problem with this approach is, workflow does not get triggered because item is created by SharePoint App

 

2. The second approach I tried is to do remote user authentication (user context) and for this, I am using user id and password to get the security token and then using this security token I am getting the cookies (rtFa and FedAuth) and then using these cookies in header to do the SPO operation. This way my workflow is triggering because request is made under user context.

 

Question is: based on my need (to trigger workflow automatically) is this second approach good enough? And ya I need to work only in REST APIs and no CSOM.

 

Thanks.

2 Replies

  • Mahendran D's avatar
    Mahendran D
    Brass Contributor

    Yes the second approach is recommended.

     

    I'm trying to do the same using Windows App but I could not get authenticated successfully. 

    The error it shows on the XML is 

    "Direct login to WLID is not allowed for this federated namespace"

    Could you please share your code via github ? 

     

     

    • Mahendran D's avatar
      Mahendran D
      Brass Contributor

      Never mind. 

      Fixed it myself. 

      In my case, I have to remove the xml formatting on retrieved response (saml assertion)

Resources