user2297037
user2297037

Reputation: 1217

Power Apps - OAUTH 2 Authentication with Azure Active Directory

I have an API that implements OAUTH Azure Active Directory Authentication. To achieve this, I created 2 App Registrations: Client and Backend.

I successfully implemented a Logic App able to call the API, so I am sure the authentication flow works.

enter image description here

Now, I need to call the same API from Power Apps, but unfortunately I got an error. First, I create a Custom Connector enter image description here

Then, I configure the Security section in this way: enter image description here

When I try to create a Connection at the end of the wizard enter image description here I get this error

AADSTS650052: The app needs access to a service ("http://rts.powerapps.com") that your organization "a467080d-9919-4241-a48f-8b0002685a59" has not subscribed to or enabled. Contact your IT Admin to review the configuration of your service subscriptions.

My Client App Registration has the following API Permissions enter image description here

UPDATE

Following @ChauncyZhou's suggestion and adding the Redirect URL generated by the Custom Connector to Client App Registration, I completed Custom Connector and Connection creation process.

When I test the API I get a 401 error:

The audience '97e**********************9c9' is invalid

Where 97e**********************9c9 is the Backend App Registration id. Did I make some mistake when I configured the Custom Connector? API works fine with Postman and Logic App.

Upvotes: 2

Views: 5690

Answers (1)

Chauncy Zhou
Chauncy Zhou

Reputation: 1065

When you call the same API from Power Apps, you don't need to add Powerapps Runtime Service permission.Because you are calling your own api,Not calling the Common Data service api.

Because you add this permission, but your organization has not subscribed to or enabled, so it causes an error.So for your question, you just need to remove PowerApps Runtime Service permissions.

Upvotes: 2

Related Questions