How to troubleshoot access denied due to service not found error?

I’m trying to get a very basic one page Javascript app to authenticate. I’m using the 03-calling-an-api example. When I click on the “Log In” button, I get an error in the browser console:

{ error: "access_denied", errorDescription: "Service not found: {TestApp}", state: "0pxyoUsOXEdEf6MMfy4eZwKgefhfc2Iw" }

When I look at the dashboard log, I see:

Failed Login       Service not found: {TestApp}

Where are service names defined? I thought it would be the name of my client (which is TestApp) but that doesn’t appear to be the case. So far I haven’t had any luck locating any information on “services” in Auth0.

3 Likes

When reporting issues happening by following existing quickstarts then please provide a direct URL to it; it can be somewhat inferred from the information, but an URL removes any doubt. Also including the exact options you are using will make the troubleshooting process easier which also may lead to faster response time, so there’s an upside for you also


Assuming you refer to the quickstart currently available at (https://auth0.com/docs/quickstart/spa/vanillajs/03-calling-an-api) and your’re using a code similar to the following:

var webAuth = new auth0.WebAuth({
    // base options
    domain: '[account].auth0.com',
    clientID: '[client_id]',
    redirectUri: window.location.href,
    responseType: 'token id_token',
    // calling an api specific options
    audience: '{TestApp}',
    scope: 'openid read:examples'
  });

Then the error in question is triggered because you’re specifying an audience that is not configured. The value of the audience parameter needs to match an existing API service identifier configured in the APIs section of your Dashboard.

If my guesses failed then please update the question with the necessary information.

5 Likes

Thank you @jmangelo I didn’t know that “audience” was an API name, nor did I know that “service not found” really meant “audience name does not match an existing API name”. I removed the Audience option and now I’m seeing the sign-in popup. Thanks again! Now to continue with my testing.

4 Likes

Thank you @jmangelo I didn’t know that “audience” was an API name, nor did I know that “service not found” really meant “audience name does not match an existing API name”. I removed the Audience option and now I’m seeing the sign-in popup. Thanks again! Now to continue with my testing.

1 Like