C# 使用GraphServiceClient登录时出现一个驱动器错误
我正在尝试使用GraphServiceClient登录,但在尝试过程中,出现以下错误消息:OneDrive报告了以下错误:基于浏览器的身份验证对话框未能完成。原因:找不到服务器或代理。 我从示例中获得的代码如下:C# 使用GraphServiceClient登录时出现一个驱动器错误,c#,onedrive,C#,Onedrive,我正在尝试使用GraphServiceClient登录,但在尝试过程中,出现以下错误消息:OneDrive报告了以下错误:基于浏览器的身份验证对话框未能完成。原因:找不到服务器或代理。 我从示例中获得的代码如下: public static GraphServiceClient GetAuthenticatedClient(){ if (graphClient == null) { // Create Microsoft Graph client.
public static GraphServiceClient GetAuthenticatedClient(){
if (graphClient == null) {
// Create Microsoft Graph client.
try {
graphClient = new GraphServiceClient(
"https://graph.microsoft.com/v1.0",
new DelegateAuthenticationProvider(
async (requestMessage) =>
{
var token = await GetTokenForUserAsync();
requestMessage.Headers.Authorization = new
AuthenticationHeaderValue("bearer", token); }));
return graphClient;
}
catch (Exception ex)
{
Debug.WriteLine(ex.Message);
}
}
return graphClient;
}
发生此错误是因为所使用的端口被防火墙阻止。发生此错误是因为所使用的端口被防火墙阻止