Hey, I have a nextjs app configured as “regular web app” in the dashboard. I’m trying to use the management API sdk in the backend before the user login. I’m passing organization name as a parameter and trying to use the …organizations.getByName, so the user doesn’t have to go through the “enter your organization” page. The problem is that I’m not able to use the management API with my nextjs app credentials. It’s weird because is authorized and it appears as a machine to machine. I’m trying to avoid using a different set of credentials since it make sense for a nextjs app to work as m2m.
I’m using this:
var ManagementClient = require('auth0').ManagementClient;
var auth0 = new ManagementClient({
domain: '{YOUR_ACCOUNT}.auth0.com',
clientId: '{YOUR_NON_INTERACTIVE_CLIENT_ID}',
clientSecret: '{YOUR_NON_INTERACTIVE_CLIENT_SECRET}',
scope: "read:users write:users read:organizations",
audience: 'https://{YOUR_TENANT_NAME}.auth0.com/api/v2/',
tokenProvider: {
enableCache: true,
cacheTTLInSeconds: 10
}
});
And I’m getting :‘{“error”:“access_denied”,“error_description”:“Unauthorized”}’,
Also, I can’t add client credentials as grant type for this app. Any help?
Thanks!
Germán