web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Power Apps Code Compon...
Power Apps
Unanswered

Power Apps Code Component : Unauthorized 401 error while making API call to CDS in PCF (Code Components) embedded Canvas App, context.userSettings is null #CanvasApps Code Component

(0) ShareShare
ReportReport
Posted on by 23

Hi All,

I am using PCF control in my canvas app which is embedded in form. In my PCF code I am making API call to get data from CDS, I am getting 401 unauthorized error, when I debugged it then I noticed the context.userSettings property doest have data.

hemantkumar_0-1599122362471.png


Could someone help me with it, how to fix it?
Does any one have faced the same issue? Not sure if its possible or not.

Thanks in advance
Hemant

 

I have the same question (0)
  • Ben Thompson Profile Picture
    1,400 on at

    You haven't told us what you are trying to do but PCF components in a Canvas App do not have access to the WebApi as it's possible for a component to be embedded in a Canvas App that doesn't have a CDS environment attached to it.

  • Hemant Kumar Sahu Profile Picture
    23 on at

    Hi @ben-thompson ,

    Thank you for the quick response.

    I am trying to get the list of entities and calling EntityDefinitions using HTTP request. Will it be possible?

    Many thanks
    Hemant

  • Ben Thompson Profile Picture
    1,400 on at

    Not via a webapi call using Xrm.WebApi.

     

    Possibly by making webapi requests using XMLHttpRequest direct to the server but you won't know without trying.

     

    Edit to add - I think the context.userSettings bit is irrelevant here - you don't need to create a new connection, you just want to use the permissions and connection the browser already has.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 528

#2
WarrenBelz Profile Picture

WarrenBelz 426 Most Valuable Professional

#3
Valantis Profile Picture

Valantis 306

Last 30 days Overall leaderboard