Identity Client Runtime Library did not get response from the Login Server when tried to connect to SharePoint programmatically

Valeriia Kalynenko 5 Reputation points
2023-05-02T07:52:59.3+00:00
Hi all, I am currently using net6.0 application to 
upload files to SharePoint site. I use nuget package SharePointOnline.Portable to perform this. 



Code sample is below:


           using var clientContext = new ClientContext(sharePointSiteUrl); // https://xxx.sharepoint.com/sites/MySite

           clientContext.Credentials = new SharePointOnlineCredentials(sharePointUserEmail, sharePointUserPassword); 

           var webContext = clientContext.Web;
           clientContext.Load(webContext, web => web.ServerRelativeUrl);
           await clientContext.ExecuteQueryAsync();



This flow worked one week ago, but now I receive an authorization error. 
Tried to use another libraries, which have almost the same syntax, 
but error Identity Client Runtime Library did not get response from 
the Login Server did not disappear. Last my step was attempt to connect via SharePoint.PowerShell, unfortunately, the result was exactly the same.

Does someone know the reasons why it is not working now? 
I would be really grateful for any help.

Thanks
.NET
.NET
Microsoft Technologies based on the .NET software framework.
1,147 questions
SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
7,037 questions
SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
1,969 questions
0 comments No comments
{count} vote

1 answer

Sort by: Most helpful
  1. RaytheonXie_MSFT 19,881 Reputation points Microsoft Vendor
    2023-05-03T02:25:20.92+00:00

    Hi @Valeriia Kalynenko ,

    Since your code worked well before, there might something error with your account. Please check the following steps

    1. Check the permission to the the site. You can refer to the article .
    2. Check if the tenant have enabled MFA. You can refer to the document Set up multifactor authentication for Microsoft 365

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.