小编Ven*_*a V的帖子

AADSTS70002:验证凭据时出错.AADSTS50012:提供了无效的客户端密钥

当我尝试使用以下代码创建身份验证标头时.我收到错误消息"AADSTS70002:验证凭据时出错.AADSTS50012:提供了无效的客户端密码." 现在,我确信,我在代码中使用的秘密与我的AAD app注册中使用的秘密不匹配.任何人都可以通过我的应用程序注册或如何在我的O365帐户目录中添加新的应用程序标识符来帮助我了解客户机密.

private string GetAuthenticationHeader(AuthenticationInformation authenticationInformation){
    try{
        return RetryHelper.InvokeWithRetries(() =>
        {
            var clientCredential = new ClientCredential(authenticationInformation.ClientId, authenticationInformation.AppSecret);
            var ac = new AuthenticationContext(authenticationInformation.Authority);
            AuthenticationResult ar = ac.AcquireToken(authenticationInformation.Resource, clientCredential);
            return ar.CreateAuthorizationHeader();
        });
    }
    catch (Exception ex){
        return ex.Message;
    }
}
Run Code Online (Sandbox Code Playgroud)

azure-active-directory

5
推荐指数
1
解决办法
8407
查看次数

标签 统计

azure-active-directory ×1