Notifications
Announcements
I am exploring creating PCF controls. One requirement is to connect to data sources outside of Dynamics/CDS. Is this capability supported by the framework? Will I need to handle my own authentication flow through adal.js accordingly?
You can call external rest api's (provided of cause you avoid any CORS related issue) and we discussed connecting to Nasa photo a day api the week before last (when I get a spare hour I will create a component that does just that and publish it on Github.
Unfortunately you will need to handle any authentication flow yourself and you really need a typescript library to do that (look at adal-ts for a typescript ADAL library).
Hi @davallen ,
We have used "cross-fetch" to do the api call.
add cross-fetch
npm install cross-fetchsample code
private async makeRequest() {let searchName = this._searchNameElement.value;console.log(searchName);
fetch('https://api.github.com/users/' + searchName , {method: "GET"}).then(res => {if (res.status >= 400) {throw new Error("Bad response from server");}return res.json();}).then(data => {console.log("Data");console.log(data);let resp = JSON.stringify(data, null, '');let j = JSON.parse(resp);this._fullNamelableElement.innerHTML = j['name'];}).catch(err => {console.error(err);});}
Hi @BenJBauer ,
Interesting to know when we use PCF components to call an api what would be the source of the request. We also had some issue with CORS. It worked when we use a wildcard.
@davallen wrote:I am exploring creating PCF controls. One requirement is to connect to data sources outside of Dynamics/CDS. Is this capability supported by the framework? Will I need to handle my own authentication flow through adal.js accordingly?
I used node-rest-client and it worked like a charm.
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.
In our never-ending quest to improve we are simplifying the forum hierarchy…
Congratulations to our 2025 community superstars!
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Kalathiya 372 Super User 2026 Season 1
WarrenBelz 303 Most Valuable Professional
MS.Ragavendar 238 Super User 2026 Season 1