koltyakov / gosip

⚡️ SharePoint SDK for Go
https://go.spflow.com
MIT License
140 stars 32 forks source link

[Question] Best approach to Auth to support online and on-premise (2019) #59

Closed cody-lettau closed 1 year ago

cody-lettau commented 1 year ago

I'm hoping for some guidance in terms of implementing a service that uses API for Remote Event Receiver handlers that can be configured in a way to support SharePoint Online and On-Premise (2019 at a minimum).

I've been using Azure Cert Auth (https://go.spflow.com/auth/strategies/azure-certificate-auth) while developing against SPO, but it doesn't appear this will work for an on-premise instance that's not setup to use Azure.

I think one option I have is to use the Addin-Only auth flow (https://go.spflow.com/auth/strategies/addin) for on-premise, but appears that may add some complications around keeping it from expiring.

Just wanted to see if there were any other recommendations!

P.S. Absolutely love this lib -- big time saver when building with Go

koltyakov commented 1 year ago

Hi Cody! Thanks for using the library.

Supported auth depends on what your SharePoint farm is configured with. E.g. if it's the default NTLM which is super common to see, and you try ADFS if won't work. So you need checking your farm first.

https://go.spflow.com/auth/strategies / On-Premises tab represents stable supported strategies for On-Prem. Technically it's NTLM or ADFS/WAP you deal with in on prem, sometimes FBA, others are rare things which I got working with during the year.

Addin strategy implemented in the library is for SharePoint Online. While On-Prem could be configured for Addins: 1) no one in a sane mind would use it (without firm arguments it's just a blast from the past); 2) Its auth flow implementation is different. Actually, I've never faced a company using addins in On-Prem ever except when it was something new and stated as a new shiny dev paradigm.

Yet, if you have On-Prem farm with addins auth configured it's possible to implement the flow as this article suggests. I can help with this, porting node-sp-auth's for instance, yet would need access to the farm to test as I have no O-Prem farm with addins configured in my disposal.

cody-lettau commented 1 year ago

@koltyakov thank you so much for the guidance! I'm definitely no expert when it comes to the configuration of SharePoint, so this is all good to know. I'll talk to our customers to see how the on-premise farms are setup and then move forward from there.

Again, thank you!!