I am creating a management API token using the following:
const client = new AuthenticationClient({
domain: <string>this.configService.get('auth0.domain'),
clientId: this.configService.get('auth0.managementClientId'),
clientSecret: this.configService.get('auth0.managementClientSecret'),
});
const token = await client.clientCredentialsGrant({
audience: '<audience>',
});
and then attempting to request a user with this token with the following
const managementClient = new ManagementClient({
domain: <string>this.configService.get('auth0.domain'),
token: token.access_token,
audience: '<audience>',
});
const auth0User = managementClient.getUser({
id: authId,
});
However, I receive the following error:
{"statusCode":401,"error":"Unauthorized","message":"Bad audience: <audience>"}
The value of <audience>
matches in all of the relevant locations, correctly matches the API identifier, and my server to server application has access to that API, so I’m really at a bit of a loss as to what is going on here