gpt4 book ai didi

azure - AdalException AADSTS90122 : User identifier is not present

转载 作者:行者123 更新时间:2023-12-02 06:32:50 24 4
gpt4 key购买 nike

我收到以下异常:AADSTS90122:用户标识符不存在

通话时:authContext.AcquireTokenAsync(resourceId, clientCred, userAssertion)

完整代码:

ClientCredential clientCred = new ClientCredential(clientId, clientSecret);
var bootstrapContext = ClaimsPrincipal.Current.Identities.First().BootstrapContext as System.IdentityModel.Tokens.BootstrapContext;
string userName = ClaimsPrincipal.Current.FindFirst(ClaimTypes.Upn) != null ? ClaimsPrincipal.Current.FindFirst(ClaimTypes.Upn).Value : ClaimsPrincipal.Current.FindFirst(ClaimTypes.Email).Value;

string userAccessToken = bootstrapContext.Token;
UserAssertion userAssertion = new UserAssertion(userAccessToken, "urn:ietf:params:oauth:grant-type:jwt-bearer", userName);
string authority = aadInstance + tenantId;

AuthenticationContext authContext = new AuthenticationContext(authority, false, null);

var result = await authContext.AcquireTokenAsync(resourceId, clientCred, userAssertion);

100% 验证参数和访问权。该代码运行了几个月,就在昨天开始挂起:/

最佳答案

Azure Active Directory 的此问题似乎现已修复。我现在可以使用 UserAssertion 和 ClientCredentials 代表用户成功获取 token (从 4 月 13 日起)。这在过去几天肯定不起作用。

关于azure - AdalException AADSTS90122 : User identifier is not present,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43370145/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com