Announcements
Hi All,We are trying to create a PCF control and wants to generate access token to call our APIs. It should be user token. Can we do that in PCF?
Regards
Pratik
I believe you should look at msal-react.
Client credential flows are blocked in the browser. They need to be executed from the backend. Pcf controls run client side. So you won't be able to do it directly in pcf.
So I would create a custom api that calls the auth endpoint and gets the token.
Then you can call that custom api from your pcf and you have a bearer token you can use in your api calls
hi @joeristroy I am not the OP but I have another question about this.
I don't quite understand how your solution is supposed to work. how can the custom API verify which user is logged in unless some credentials are passed into it?
It can't.
We were talking about a 3th party api, not the dynamics web api.
And the process to obtain a token differs from api to api.
So unless the 3th party api is also using the same Microsoft tenant for it's authentication you probably won't be able to identify the logged in user.
If you are just trying to call the dynamics web api you don't need to authenticate. That will work oob
OK Thanks for that response - it's good to know I didn't miss anything.
FWIW here's the workaround I used, which is rather elaborate but was the best I could come up with:
Obviously this mechanism doesn't allow the third party API to impersonate the user in Dataverse but it does at least allow it to verify that it has been called by a logged-in user
Hi Tim,Thanks for the reply, do you have any detailed reference to the workaround you mentioned. I would like to try that. Thanks.
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.
Congratulations to our 2026 Super Users!
Congratulations to our 2025 community superstars!
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Haque 94
WarrenBelz 82 Most Valuable Professional
Kalathiya 38 Super User 2026 Season 1