我第一次针对Azure Active Directory B2C进行开发。我正在开发WPF /桌面应用程序。
登录和注销一直运行良好,直到今天莫名其妙地停止了工作,现在在登录过程中引发了以下异常。
AADB2C90079: Clients must send a client_secret when redeeming a confidential grant.
有一个建议,我需要刷新此堆栈溢出问题中概述的令牌: Azure B2C Custom Policies: Invalid Request, client secret error
但是我丝毫不知道如何执行此操作。
这是我的登录代码(正在引发异常的Await PublicClientApp.AcquireTokenAsync(...))
Public Async Function SignIn() As Task(Of Boolean)
Dim authResult As AuthenticationResult = Nothing
Dim accounts As IEnumerable(Of IAccount) = Await PublicClientApp.GetAccountsAsync()
Try
authResult = Await PublicClientApp.AcquireTokenAsync(ApiScopes, GetUserByPolicy(accounts, PolicySignUpSignIn), UIBehavior.SelectAccount, String.Empty, Nothing, Authority)
userProf = Await GetUserInformation()
SignInState = SignInStateEnum.SignedIn
Return True
Catch ex As MsalServiceException
Try
If ex.Message.Contains("AADB2C90118") Then
authResult = PublicClientApp.AcquireTokenAsync(ApiScopes, GetUserByPolicy(accounts, PolicySignUpSignIn), UIBehavior.SelectAccount, String.Empty, Nothing, AuthorityResetPassword).Result
userProf = GetUserInformation().Result
SignInState = SignInStateEnum.SignedIn
Return True
Else
logger.Error($"Error Acquiring Token:{Environment.NewLine}{ex}")
logger.Error("Exception Raised", ex)
userProf = Nothing
SignInState = SignInStateEnum.SignedOut
Return False
End If
Catch __unusedException1__ As Exception
logger.Error("Exception Raised", __unusedException1__)
userProf = Nothing
SignInState = SignInStateEnum.SignedOut
Return False
End Try
Catch ex As Exception
logger.Error($"Users:{String.Join(",", accounts.[Select](Function(u) u.Username))}{Environment.NewLine}Error Acquiring Token:{Environment.NewLine}{ex}")
logger.Error("Exception Raised", ex)
userProf = Nothing
SignInState = SignInStateEnum.SignedOut
Return False
End Try
End Function
答案 0 :(得分:1)
这已被确定为Azure问题 这是我从Azure支持获得的消息: “该问题被发现是一个后端问题。我们的产品团队已经找到了问题,并已部署此修复程序。您能否再试一次,让我知道它是否现在对您的租户有效?”