找不到CloudAdapter.createConversationAsync的任何相关文档。我找不到我做错了什么。
下面是我尝试运行的代码:
const {
CloudAdapter,
ConfigurationBotFrameworkAuthentication,
ConfigurationServiceClientCredentialFactory,
} = require('botbuilder');
const adapter = new CloudAdapter(new ConfigurationBotFrameworkAuthentication(
{},
new ConfigurationServiceClientCredentialFactory({
MicrosoftAppId: process.env.MS_BOT_ID,
MicrosoftAppPassword: process.env.MS_BOT_PASSWORD,
MicrosoftAppType: 'MultiTenant',
}),
));
const userId = 'XXXX';
const tenantId = 'YYYY';
adapter.createConversationAsync(
process.env.MS_BOT_ID,
'msteams',
'https://smba.trafficmanager.net/teams/',
userId, // audience
{
isGroup: false,
bot: {
id: process.env.MS_BOT_ID,
},
members: [{ id: userId }],
tenantId,
},
console.log,
);
这是我的错误:
{"error":"invalid_resource","error_description":"AADSTS500011: The resource principal named XXXX was not found in the tenant named Bot Framework. This can happen if the application has not been installed by the administrator of the tenant or consented to by any user in the tenant. You might have sent your authentication request to the wrong tenant.\r\nTrace ID: -------\r\nCorrelation ID: -----\r\nTimestamp: 2023-05-24 09:10:35Z","error_codes":[500011],"timestamp":"2023-05-24 09:10:35Z","trace_id":"-------","correlation_id":"-------","error_uri":"https://login.microsoftonline.com/error?code=500011"}
1条答案
按热度按时间pbgvytdp1#
根据上述错误,只有在名为{tenant}的租户中未找到名为{name}的资源主体时,才会发生此错误。如果租户的管理员尚未安装应用程序或租户中的任何用户尚未同意应用程序,则可能发生这种情况。
您可能将身份验证请求发送给了错误的租户。
如果您希望安装应用程序,则可能需要提供管理员权限才能添加应用程序。请咨询资源和应用程序的开发人员,了解适合您的租户的正确设置。
你能检查一下吗?
CloudAdapter文档。createConversationAsync-https://learn.microsoft.com/en-us/dotnet/api/microsoft.bot.builder.cloudadapterbase.createconversationasync?view=botbuilder-dotnet-stable