Issue authenticating to Auth0 via Swagger UI (.NET) with client credentials

Viewed 872

I'm trying to authenticate to my Auth0 tenant via the Swagger UI (auto-generated by Swashbuckle.AspNetCore) using client credentials.

I'm getting the following error:

Auth ErrorError, error: access_denied, description: Non-global clients are not allowed access to APIv1

Here's a screen shot:

enter image description here

Open API spec looks like this:

"securitySchemes": {
   "auth0": {
      "type": "oauth2",
      "flows": {
         "clientCredentials": {
            "tokenUrl": "https://example.auth0.com/oauth/token"
         },
         "authorizationCode": {
            "authorizationUrl": "https://example.auth0.com/authorize?audience=test",
            "tokenUrl": "https://example.auth0.com/oauth/token",
            "scopes": { }
         }
      }
   }
}

I suspect this has something to do with the audience not being specified. I was having a similar issue with authorization code flow, but manged to get this working by appending the audience as a query-string param to the authorizationUrl (as shown above). Unfortunately the same trick doesn't work with client credential flow (i.e. attempting to append the audience to the tokenUrl). I need to support client credential flow, as one or more of the routes need to be locked down to M2M tokens only.

Interestingly, it works if I use the global client ID / secret (found under the advanced settings of the tenant), but I'm not sure if we should use this...

Anyone else ran into this issue and if so, any luck with finding a solution?

0 Answers
Related