使用用户名和密码从nodejs应用程序获取B2C中的令牌 [英] Get token from B2C from nodejs application using user name and password
问题描述
您好,
我尝试使用Adal库根据用户名和密码获取b2c令牌。
它失败了以下消息:"AADSTS50049:未知或无效实例。"
NodeJs代码非常简单:
var context = new AuthenticationContext( applicationConfig.authority);
context.acquireTokenWithUsernamePassword(resource,userdata.id,userdata.pwd,applicationConfig.clientId,function(err,tokenResponse){
if (错误){
$
console.log('好吧,没有工作:'+ err.stack);
}否则{
console.log(tokenResponse);
}
});
applicationConfig参数来自我的b2c租户。
我使用了以下示例:https://github.com/AzureAD/azure-activedirectory-library-for-nodejs/tree/master/sample
<有谁知道我错过了什么?这个错误的根本原因是什么?
提前谢谢。
问候。
David
您使用的是哪个MSAL版本?我听说过早期版本的MSAL会发生这种情况,以后会修复。
Hello,
I tried using Adal library to get a b2c token based on user name and password.
It fails with the following message : "AADSTS50049: Unknown or invalid instance."
The NodeJs code is quite simple:
var context = new AuthenticationContext(applicationConfig.authority);
context.acquireTokenWithUsernamePassword (resource, userdata.id, userdata.pwd, applicationConfig.clientId, function(err, tokenResponse) {
if (err) {
console.log('well that didn\'t work: ' + err.stack);
} else {
console.log(tokenResponse);
}
});
The applicationConfig parameters come from my b2c tenant.
I used an example from : https://github.com/AzureAD/azure-activedirectory-library-for-nodejs/tree/master/sample
Does anyone know what I'm missing ? What is the root cause of this error ?
Thank you in advance.
Regards.
David
Which MSAL version are you using? I have heard of this happening with earlier versions of MSAL that were later fixed.
这篇关于使用用户名和密码从nodejs应用程序获取B2C中的令牌的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!