Forum Discussion

BFasano_WIN's avatar
BFasano_WIN
Copper Contributor
Feb 08, 2023

Trouble with OAuth Bearer Token to get list of folders.

We're trying to utilize Azure Data Factory to read an Excel file on SharePoint. 

We've registered the app in AD, we've trusted the app in SharePoint. 

I can make a web call to: https://accounts.accesscontrol.windows.net/[Our_TenantID]/tokens/OAuth/2

and I receive a valid token. 

When I try to pass that token to https://[Tenant_NAME].sharepoint.com/sites/[TeamSite]/_api/web/GetFolderByServerRelativeUrl('/Shared%20Documents/Config/')/Files

I get this response: {"odata.error":{"code":"-2147024891, System.UnauthorizedAccessException","message":{"lang":"en-US","value":"Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))"}}}

 

I don't know if I don't have the right Relative URL, or if I don't have the App Registration / Trust set up correct. 

Does anyone have experience with this? 

Thanks, in advance, 

 

-Brian

No RepliesBe the first to reply

Resources