我有一个node.js应用程序,我试图使用PnPjs的AdalFetchClient从共享点获取一些数据。
sp.setup({
sp: {
baseUrl: "https://placeholder.sharepoint.com",
fetchClientFactory: () => {
return new AdalFetchClient("tenantId", "azure_clientId", "azure_clientSecret");
},
},
});
await sp.web.getAppCatalog().get();
我收到此错误:Error making HttpClient request in queryable [401] Unauthorized ::> {"error_description":"Invalid issuer or signature."}
我像这样设置我的Azure活动目录应用程序的权限: Azure App permissions
我向我要从中获取数据的承租人授予了所有权限: Granted permissions to Azure App
我使用的示例在这里:https://pnp.github.io/pnpjs/nodejs/adal-fetch-client/ 我还尝试将AdalFetchClient与图一起使用。只有sharepoint api似乎有问题。
答案 0 :(得分:0)
我找到了解决方案。有一个AdalCertificateFetchClient,它需要以下参数:
因此,首先您必须创建一个x.509证书。我为此使用了this tutorial。 (为此)
此后,您必须通过将证书安装到本地计算机并遵循this steps
来获得指纹。最后一步是获取证书的私钥。为此,您必须为Windows安装openssl并遵循this steps
现在您可以使用您的AdalCertificateFetchClient