无法使用 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
我正在使用 Angular 8 开发一个应用程序并尝试连接到 Azure Data Lake Gen 2's FileSystem through its REST API 以便也能够检索文件夹列表和文件导入一样。
为了进行身份验证,我使用了库 msal-angular,它允许我通过 loginPopup
函数和 access 检索 ID 令牌 token 通过 acquireTokenSilent
函数。
我正在使用这个方案作为指导:aad connection flow
范围:['user.read','api://<uuid>/user_impersonation']
。 api scopes
然后我使用 storage-datalake 库尝试从我的数据湖中检索信息。所以我使用我登录的用户的 访问令牌 创建一个 DataLakeStorageClient
和 TokenCredentials
。然后我尝试恢复我的一个文件系统上的文件夹列表。
我收到此错误:401 (Server failed to authenticate the request. Please refer to the information in the www-authenticate header.)
。
Do you have any idea where my problem might come from?
我的用户具有以下角色:
- 贡献者
- 存储 Blob 数据贡献者
API 权限: api permissions
当我在没有用户模拟的情况下使用END-USER authentication(作为服务主体)时,我可以访问我的文件系统...
在此先感谢您的帮助。
范围不正确。您不能在范围内使用两种资源。 user.read
用于 https://graph.microsoft.com
资源。 api://<uuid>/user_impersonation
用于您自己的资源。
您可以尝试使用 ['https://datalake.azure.net/.default']
作为范围。
我正在使用 Angular 8 开发一个应用程序并尝试连接到 Azure Data Lake Gen 2's FileSystem through its REST API 以便也能够检索文件夹列表和文件导入一样。
为了进行身份验证,我使用了库 msal-angular,它允许我通过 loginPopup
函数和 access 检索 ID 令牌 token 通过 acquireTokenSilent
函数。
我正在使用这个方案作为指导:aad connection flow
范围:['user.read','api://<uuid>/user_impersonation']
。 api scopes
然后我使用 storage-datalake 库尝试从我的数据湖中检索信息。所以我使用我登录的用户的 访问令牌 创建一个 DataLakeStorageClient
和 TokenCredentials
。然后我尝试恢复我的一个文件系统上的文件夹列表。
我收到此错误:401 (Server failed to authenticate the request. Please refer to the information in the www-authenticate header.)
。
Do you have any idea where my problem might come from?
我的用户具有以下角色:
- 贡献者
- 存储 Blob 数据贡献者
API 权限: api permissions
当我在没有用户模拟的情况下使用END-USER authentication(作为服务主体)时,我可以访问我的文件系统...
在此先感谢您的帮助。
范围不正确。您不能在范围内使用两种资源。 user.read
用于 https://graph.microsoft.com
资源。 api://<uuid>/user_impersonation
用于您自己的资源。
您可以尝试使用 ['https://datalake.azure.net/.default']
作为范围。