我的代码使用这个函数:
// Function to retrieve the Guardians Enrollments (MFA)
function getMFAEnrollments(auth0Client, auth0UserId) {
return new Promise((resolve, reject) => {
auth0Client.getGuardianEnrollments({ id: auth0UserId }).then((enrollments) => {
resolve(enrollments);
}).catch((err) => {
const errMFA = {
code: 'scim_error_MFA_getGuardianEnrollments',
message: 'Error: Unable to retrieve the enrollments!',
details: err
};
reject(errMFA);
});
});
}
但是当我尝试使用同一个类中的另一个函数时(看起来工作方式相同,请参见auth0 docs),我的请求返回了一个错误:“auth0Client.getUserBlocks不是函数”
// Function to retrieve the User's Blocks (brute-force)
function getBlocksById(auth0Client, auth0UserId) {
return new Promise((resolve, reject) => {
auth0Client.getUserBlocks({ id: auth0UserId }).then((blocks) => {
resolve(blocks);
}).catch((err) => {
const errBlocks = {
code: 'scim_error_Blocks_getUserBlocks',
message: 'Error: Unable to retrieve blocks!',
details: err
};
reject(errBlocks);
});
});
}
有人知道为什么会这样吗?谢谢
1条答案
按热度按时间pn9klfpd1#
通过你的文档,你留下了链接,我认为会有问题取决于您的应用程序设计结构
getGuardianEnrollments属于UserManager(提供获取用户信息和模拟用户的方法),getUserBlocks属于ManagementClient。ManagementCLient和UserManager似乎是应用程序的独立模块或类。要调用getUserBlocks函数,只需将ManagementCLient示例传递给***getBlocksById()***函数