Skip to content

Added Support for Limit M2M #1100

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
May 29, 2025
Merged

Conversation

tanya732
Copy link
Contributor

@tanya732 tanya732 commented Apr 9, 2025

Changes

Added changes in below endpoint

Path HTTP Method Method Name
/clients POST create
/clients GET getAll
/clients/{id} GET get
/clients/{id} PATCH update
/organizations POST create
/organizations GET getAll
/organizations/{id} PATCH update
/organizations/{id} GET get
/organizations/name/{name} GET getByName
/tenants/settings GET getSettings
/tenants/settings PATCH updateSettings

New Properties Added to Interfaces:

Client:
par_request_expiry: Specifies how long a Pushed Authorization Request URI remains valid.
token_quota: Represents a token quota.
ClientCreate:
default_organization: Details about the default organization.
par_request_expiry: Specifies validity duration for Pushed Authorization Request URI.
token_quota: Represents token quotas.
ClientUpdate:
token_quota: Represents token quotas.
TenantSettings:
default_token_quota: Token quotas for all clients and organizations.
oidc_logout: Configuration for OIDC RP-initiated logout.
TenantSettingsFlags:
New flags, such as improved_signup_bot_detection_in_classic, enable_dynamic_client_registration, custom_domains_provisioning, etc.
TenantSettingsUpdate:
Similar additions as TenantSettings.
GetOrganizations200ResponseOneOfInner:
token_quota: Represents a token quota.
PostOrganizations201Response:
Metadata properties limit increased from 10 to 25.
token_quota: Represents a token quota.

New Interfaces:

References

https://oktawiki.atlassian.net/wiki/spaces/IAMPS/pages/3283157572/M2M+Token+Quota+SDK+Requirements#Authentication-SDK-Requirements

Manual Testing

Securely store your Client ID, Client Secret, and Management API token.
Install the SDK: npm install auth0


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

const getTenantSetting = await auth0.tenants.getSettings({});
console.log('getTenantSetting Response Data for clients:', getTenantSetting.data.default_token_quota?.clients.client_credentials);
console.log('getTenantSetting Response Data for organizations:', getTenantSetting.data.default_token_quota?.organizations.client_credentials);


const tokenQuotaPayload: TenantSettingsUpdate = {
    default_token_quota: {
      clients: {
        client_credentials: {
          per_day: 1000,
          per_hour: 200,
          enforce: true
        }
      },
      organizations: {
        client_credentials: {
          per_day: 1000,
          per_hour: 200,
          enforce: true
        }
      }
    }
  };

const updateTenantSetting = await auth0.tenants.updateSettings(tokenQuotaPayload);
console.log('updateTenantSetting Response Data for clients:', updateTenantSetting.data.default_token_quota?.clients.client_credentials);
console.log('updateTenantSetting Response Data for organizations:', updateTenantSetting.data.default_token_quota?.organizations.client_credentials);



const getClientById = await auth0.clients.get({client_id : "<CLIENT_ID>"})
console.log('getClientById Response Data:', getClientById.data.token_quota);

const updateClientPayload: ClientUpdate = {
    token_quota: {
        client_credentials: {
          per_day: 100,
          per_hour: 10,
          enforce: true
        
      }
    }
  };

const updateClient = await auth0.clients.update({client_id : "<CLIENT_ID>"}, updateClientPayload);
console.log('updateClient Response Data:', updateClient.data.token_quota);


const createClientPayload: ClientCreate = {
    name : "ForTestTokenQuota",
    token_quota: {
        client_credentials: {
          per_day: 100,
          per_hour: 20,
          enforce: true
        
      }
    }
  };

const createClient = await auth0.clients.create(createClientPayload);
console.log('createClient Response Data:', createClient.data.token_quota);



const createOrganizationPayload: PostOrganizationsRequest = {
    name : "tokenquota",
    display_name : "CreatedForTestTokenQuota", 
    token_quota: {
        client_credentials: {
          per_day: 100,
          per_hour: 20,
          enforce: true
        
      }
    }
  };

const createOrganization = await auth0.organizations.create(createOrganizationPayload);
console.log('createOrganization Response Data:', createOrganization.data.token_quota);


const updateOrganizationPayload: PatchOrganizationsByIdRequest = {
    token_quota: {
        client_credentials: {
          per_day: 100,
          per_hour: 10,
          enforce: true
        
      }
    }
  };

const orgID: PatchOrganizationsByIdOperationRequest = {
    id : createOrganization.data.id
}

const updateOrganization = await auth0.organizations.update(orgID, updateOrganizationPayload);
console.log('updateOrganization Response Data:', updateOrganization.data.token_quota);


const getOrganizations = await auth0.organizations.getAll()
console.log('getOrganizations Response Data:', getOrganizations.data[0].token_quota);


const org_id: GetOrganizationsByIdRequest = {
    id : createOrganization.data.id
}
const getOrganizationsById = await auth0.organizations.get(org_id)
console.log('getOrganizationsById Response Data:', getOrganizationsById.data.token_quota);

const getUserOrg = await auth0.users.getUserOrganizations({id : "<USER_ID>"})
console.log('getUserOrg Response Data:', getUserOrg.data[0].token_quota);

Testing

Please describe how this can be tested by reviewers. Be specific about anything not tested and reasons why. If this library has unit and/or integration testing, tests should be added for new functionality and existing tests should complete without errors.

  • This change adds unit test coverage
  • This change adds integration test coverage

Checklist

@tanya732 tanya732 requested a review from a team as a code owner April 9, 2025 11:39
@tanya732 tanya732 changed the title Added fields for tenant Settings Added Support for Limit M2M Apr 24, 2025
Copy link
Contributor

@kushalshit27 kushalshit27 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tennant Settings changes are not added yet

Copy link
Contributor

@kushalshit27 kushalshit27 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@tanya732 tanya732 merged commit b0c8463 into master May 29, 2025
8 checks passed
@tanya732 tanya732 deleted the limit-M2M-usage-node-auth0-support branch May 29, 2025 07:31
@tanya732 tanya732 mentioned this pull request May 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants