繁体   English   中英

无法使用 azure-sdk-for-js 使用 Angular 访问 Azure Data Lake Gen2 的文件系统

[英]Unable to access FileSystem of Azure Data Lake Gen2 with Angular using azure-sdk-for-js

I am developing an application with Angular 8 and trying to connect to Azure Data Lake Gen 2's FileSystem through its REST API in order to be able to retrieve the list of folders as well as do a file import.

对于身份验证,我使用库msal-angular ,它允许我通过 loginPopup function 检索ID 令牌,并通过loginPopup acquireTokenSilent检索访问令牌

我使用这个方案作为指导: aad connection flow

scope: ['user.read','api://<uuid>/user_impersonation'] api 瞄准镜

然后我使用storage-datalake库尝试从我的数据湖中检索信息。 因此,我使用登录用户的访问令牌来创建带有DataLakeStorageClientTokenCredentials 然后我尝试恢复我的一个文件系统上的文件夹列表。

我收到此错误: 401 (Server failed to authenticate the request. Please refer to the information in the www-authenticate header.)

你知道我的问题可能来自哪里吗?

我的用户具有以下角色:

  • 贡献者
  • 存储 Blob 数据贡献者

API 权限: api 权限

当我在没有用户模拟(作为服务主体)的情况下使用END-USER 身份验证时,我可以访问我的文件系统......

预先感谢您的帮助。

scope 不正确。 您不能在 scope 中使用两种资源。 user.read用于https://graph.microsoft.com资源。 api://<uuid>/user_impersonation用于您自己的资源。

您可以尝试使用['https://datalake.azure.net/.default']作为 scope。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM