perlas has asked for the wisdom of the Perl Monks concerning the following question:

Hello! I am trying to study perl since no one from our company knows this technology and we have a solution that has been working for more than 5 years that uses perl. it is a fairly stable solution and we have only encountered an issue with it recently when the company migrated documents to sharepoint online 2010. Basically we have an application that runs on linux and uses perl to access websites to get documents. However, our current perl script seems to be incompatible with linking to sharepoint. For one, the sharepoint uses two factor authentication upon login via pingid. is there a way to use perl to override this? or how could this be handled at the backend? Sharepoint owners have told us to use the available REST APIs. But, we are not sure how to integrate this with perl and linux. I've tried reading some references and most of the codes uses NTLM. Our script uses Mechanize. Which of the two would be more efficient to use with sharepoint that has a two factor authentication? Would greatly appreciate your help. Thanks!
  • Comment on Perl with Sharepoint and two factor authentication

Replies are listed 'Best First'.
Re: Perl with Sharepoint and two factor authentication
by tron (Novice) on Feb 02, 2018 at 01:29 UTC
    In my experience, REST APIs make it easier to communicate. If you are allowed to install modules, then a quick look at CPAN reveals http://search.cpan.org/~mcrawfor/REST-Client-88/lib/REST/Client.pm as a module for interacting with a REST endpoint. Given the fact that who ever made the script used Mechanize, more than likely you'll be making a POST or a GET call. Ask the share point admins to give you a sample request with headers. You'll more than likely have to get acquainted with REST but it's worth the while.
      a quick look at CPAN reveals http://search.cpan.org/~mcrawfor/REST-Client-88/lib/REST/Client.pm

      I'll bite. Why have you picked that old version of the module from 9 years ago? The most recent release as of today is version 273 from August 2015. Far better to get the latest version with all the fixes, no? Or is there something particular to version 88 that you think perlas requires?

      Like you, I am happy to recommend Rest::Client but I would use the latest version.

        Agree with hippo, I just recently (past 3 months) used REST::Client (version 273) and it worked fine. Get the latest.

        I apologize. Please use the latest. I just happened to click on the first link that appeared. :)
Re: Perl with Sharepoint and two factor authentication
by dasgar (Priest) on Feb 02, 2018 at 16:14 UTC

    This probably won't help, but you might get a laugh out of it.

    When I saw your post about Perl and SharePoint, I remember stumbling across a blog post that had me laughing. I don't even remember what I was searching for when I came across it. The blog post that I'm referring to can be found here. Here's the part that cracked me up since I did not enjoy maintaining a SharePoint site at $work and I like to use Perl.

    Why on earth would these two disparate camps ever meet? Perl is 15 million years old, right, and SharePoint is the bane to system administrators everywhere. The small “SharePerl” audience includes me, and two or three really old techs that still use land line phones.

    Anyways, that blog post was dealing with using Perl to access SharePoint. However, I don't think its dealing with 2 factor authentication. Like I said, probably not all that helpful, but thought I'd share anyways.