Hi @Anonymous
You will want to change to modern authentication as per the similar topic at https://learn.microsoft.com/en-us/answers/questions/810878/csom-backend-with-modern-authentication.html
There is an example in that question which you can use to authenticate.
---------------------------------
If this is helpful please accept answer.