Radityo Ardi
Radityo Ardi

Reputation: 138

Dynamics (Power Platform) 401 Unauthorized error when opening the Web API URL

Hi Dynamics experts out there, I have built a custom SPFx web part in SharePoint Online that has links to Dynamics (Power Platform) as part of the feature. The link basically will just download a file from a specific column of a specific table from Dataverse, that's all.

It works fine in my DEV environment, but apparently not in Test and Production tenant.

The way I did it for testing was just to open the browser (since it's GET) and use the following direct URL.

https://[organization-name].crm5.dynamics.com/api/data/v9.1/radityo_bookrequests(60781419-1937-ec11-8c64-002248168a60)/radityo_pdfattachment/$value

Surprisingly, this also happens with the standard URL to get the Dataverse metadata, that is

https://[organization-name].crm5.dynamics.com/api/data/v9.1/$metadata

The error that came out is like this: Error1

While, it should be working just like this: working

I have checked out the permissions (to see if it's the Dataverse table permission) but it's not. Even after adding a user into System Administrator (via Power Platform Admin Settings > Security Role), the issue persists.

Any idea where to fix this?

Upvotes: 0

Views: 1775

Answers (1)

Radityo Ardi
Radityo Ardi

Reputation: 138

This issue is closed.

It was because the user really is unauthorized due to the absence of Single Sign-on for Dynamics Web API. Though I'm logged in when I go to the following URL:

https://[organization-name].crm5.dynamics.com/

it pops up another login again.

Once successfully log in, I can see the results. enter image description here

Very interesting 😊

I'll post feedback to Microsoft then.

Upvotes: 0

Related Questions