【问题标题】:Web application hangs while calling Graph APIWeb 应用程序在调用 Graph API 时挂起
【发布时间】:2019-05-28 22:28:03
【问题描述】:

我们开发了一个 asp.net Web 应用程序,我们在其中使用 Azure B2C 执行身份验证,并调用 Azure Graph API 来获取其他自定义属性。我能够使用 OpenIDConnectMiddleware 成功进行身份验证。但是当我尝试使用 Azure Graph API 获取用户信息时,它会挂起。

AuthenticationResult result = await authContext.AcquireTokenAsync(this.aadGraphResourceId, credential);

【问题讨论】:

标签: azure-ad-b2c


【解决方案1】:

应该是这样的吧

AuthenticationResult result = await authContext.AcquireTokenAsync(this.aadGraphResourceId, credential).ConfigureAwait(false);

【讨论】:

  • 嗨,我试过这个选项,但在向 Graph API 发送请求时它仍然挂起。下面是它尝试重定向的 URL https:////B2C_1A_signup_signin/api/CombinedSigninAndSignup/confirmed?csrf_token
  • 我按照下面 URL 中提到的步骤操作,但我仍然面临同样的问题。stackoverflow.com/questions/49314330/…。 @Chris Padgett,您能否就此提供您的意见。
【解决方案2】:

我在阻塞方法中调用等待

Wait 更改为 await。使用异步代码时,你应该去async all the way。如果你没有,那么你可以cause a deadlock

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-08-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-04-15
    • 2012-07-03
    相关资源
    最近更新 更多