auth0/node-auth0

Docs for creating ManagementClient are incorrect

alph486 opened this issue · 2 comments

Checklist

  • I have looked into the Readme, Examples, and FAQ and have not found a suitable solution or answer.
  • I have looked into the API documentation and have not found a suitable solution or answer.
  • I have searched the issues and have not found a suitable solution or answer.
  • I have searched the Auth0 Community forums and have not found a suitable solution or answer.
  • I agree to the terms within the Auth0 Code of Conduct.

Description

In the README.md there is example code for creating a client like this:

var management = new ManagementClient({
  domain: '{YOUR_TENANT_AND REGION}.auth0.com',
  clientId: '{YOUR_CLIENT_ID}',
  clientSecret: '{YOUR_CLIENT_SECRET}',
});

However, this object (in typescript ManagementClientOptionsWithClientSecret is not an option for creating ManagementClient in the current version:

see management-client.ts

export declare class ManagementClient extends ManagementClientBase {
    constructor(options: ManagementClientOptionsWithToken);
    constructor(options: ManagementClientOptionsWithClientCredentials);
}

Reproduction

  1. Attempt to create a client as described in the Readme.md
  2. In typescript linting and at compile time will get error
No overload matches this call.
  Overload 1 of 2, '(options: ManagementClientOptionsWithToken): ManagementClient', gave the following error.
    Object literal may only specify known properties, and 'clientId' does not exist in type 'ManagementClientOptionsWithToken'.ts(2769)

Additional context

No response

node-auth0 version

4.3.1

Node.js version

18.17.1

As you can see here, ManagementClientOptionsWithClientSecret is an option, as ManagementClientOptionsWithClientCredentials can be either ManagementClientOptionsWithClientSecret or ManagementClientOptionsWithClientAssertion.

As you can see here, it works fine for me:
image

Can you share some more information to help us understand whats causing your issue?

Yes this is due to some misunderstanding on my end I think. I'll close it.