I have an unattended, scheduled batch process -- written in C# -- that needs to access data in a list in SharePoint Online. It will make an HTTP call to the REST API from a completely external environment.
What's the best way to manage authentication/access?
I can (and have for testing) just hard-coded a username and password, using the SharePointOnlineCredentials
class. This works fine, but it's clearly not ideal, as you have the credentials for a user sitting in code or configuration. Call this "the nuclear option."
What I'd like is to be able to generate an access token for that specific list or an access token for an "API user" which I could pass with the request.
I could make a user specifically to be used by this process, but that seems like overkill, since they'd be a full Office 365 user, and I'd be paying for a full user to do this one thing.
Besides authenticating as a full-blown user, what other options exist for this access?