1 year ago

#386928

test-img

Thomas Hellström

CSOM backend with Modern Authentication

I've been developing some backend code which connects to Sharepoint Online using CSOM and .Net Framework.

_context = new ClientContext(_sharepointDocumentRootUrl);                
SecureString securePassword = new SecureString();
foreach (char c in _sharepointPassword)
{
    securePassword.AppendChar(c);
}
_context.Credentials = new SharePointOnlineCredentials(_sharepointUserName, securePassword);

This worked well until the auth method was changed from Legacy Auth to Modern Auth. Now we get a "The sign-in name or password does not match one in the Microsoft account system"

Of course, we've double/tripple-checked the username/password.

Since it's backend code/system account we can't use OfficeDevPnP. The system account has MFA turned off. The IT department wont let us use the SharePoint App-Only auth method. And they are very sceptical to allow legacy auth for or system account.

I've been googling around without any success. Any ideas?

//Thomas

authentication

csom

.net-4.8

0 Answers

Your Answer

Accepted video resources