microsoft / microsoft/Power-Fx

Error InvalidAuthenticationAudience when calling a Custom API from a Canvas App

Open
#2,986 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
3.4k
Forks
358
Avg merge
10h 34m
Merged PRs (30d)
3

Description

Hello, we are getting this error when calling a Custom API in our dev environment:

"response": {
          "error": {
            "code": "InvalidAuthenticationAudience",
            "message": "The received access token has been obtained from wrong audience or resource 'https://xxx.crm4.dynamics.com/'. It should exactly match (including forward slash) with one of the allowed audiences 'https://service.powerapps.com/','https://apps.powerapps.com','https://apps.powerapps.com/','https://apihub.azure.com','https://api.powerplatform.com'."
          }
        }
"_serviceType": "connector",
      "_suggestedErrorMessage": {
        "message": "One or more of your connections may not be authenticated. Please restart the app to fix this."
      },
      "_diagnosticMessage": "The received access token has been obtained from wrong audience or resource 'https://xxx.crm4.dynamics.com/'. It should exactly match (including forward slash) with one of the allowed audiences 'https://service.powerapps.com/','https://apps.powerapps.com','https://apps.powerapps.com/','https://apihub.azure.com','https://api.powerplatform.com'."
    }

The Power FX code is:

Environment.book_api(
            {
                qId: Quote.Quote,
                qoId: Option.'Quote Product',
                bill: varBill
            }
        );

Our environment is in North Europe, which should not have an impact.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No repository files, tests, or entry points are named. Start by reproducing the shown Environment.book_api call and inspect the InvalidAuthenticationAudience diagnostic; done means locating the relevant connector or authentication handling and establishing a repository-specific reproduction or confirmed cause.

Written by the indexing model from the issue text.

Assessment

Domain
api, authentication
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.