CORS issue while getting token with Oauth 2.0 Client credential flow using React embedded PowerApps PCF Component

Dhruvil Dave 6 Reputation points
2021-10-28T15:10:51.767+00:00

I am able to get the Bearer token from the postman using this api
https://login.microsoftonline.com/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/oauth2/v2.0/token

client_id : <client-id/app-id>,
resource : <resource>,
client_secret:<client-secret>,
grant_type : "client_credentials"
Content-Type : "application/x-www-form-urlencoded"

and I am trying to use this flow in Powerapps PCF Component.
This PCF component is embedded into a canvas app.
I can use grant_type=authorization_code but I have to add a redirect_uri and I don't want to add any redirection to my code.
Is there any way, I can get the access token and don't get any cors issues?
I want to acquire a token without a login popup if possible.

Error on local environment
144622-screenshot-2021-10-28-at-112633-am.png

Error in canvas app when i embed PCF solution on canvas app
144643-screenshot-2021-10-28-at-113119-am.png

Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
19,605 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Dhruvil Dave 6 Reputation points
    2022-01-27T07:09:42.637+00:00

    I resolved it by adding a logic flow in powerapps.
    I created a HTTP logic flow and sending the client credentials there and processing the Access Token api and in the response i am getting the access token. so now i am not getting any CORS issue.

    0 comments No comments