I have the following code to connect to a site collection:-
string s = "******8";
SecureString passWord = new SecureString();
foreach (var cc in s)
passWord.AppendChar(cc);
using (ClientContext context = new ClientContext("https://***.sharepoint.com/sites/***/"))
{
try
{
context.Credentials = new SharePointOnlineCredentials("***@***.onmicrosoft.com", passWord);
context.Load(context.Web);
context.ExecuteQuery();
but on the context.ExecuteQuery();
i am getting The sign-in name or password does not match one in the Microsoft account system.
.. although i am 100% sure that the username/password are correct.. but if i login to the UI using the username i will get a 2-factor authentication, so could this be the issue?