Skip to content

Added Support for Limit M2M Auth API #1107

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

tanya732
Copy link
Contributor

@tanya732 tanya732 commented May 2, 2025

Changes

New Utility Added:
Introduced a new file src/lib/httpResponseHeadersUtils.ts to provide utility functions related to HTTP response headers.

New Test File:
Added a new test file test/lib/HttpResponseHeadersUtils.test.ts to ensure proper testing of the HttpResponseHeadersUtils utility.

References

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

Manual Testing

Get domain, clientId, clientSecret from tenant

const auth = new AuthenticationClient({
  domain: '<DOMAIN>',
  clientId: '<CLIENT_ID>',
  clientSecret: '<CLIENT_SECRET>',
});

const resp = await auth.oauth.clientCredentialsGrant({
  audience: '<AUDIENCE>',
});

const headers = resp.headers;

/*
To Fetch Token Quota Headers for Client.

For Example - Sample response
clientQuota  {
  perHour: { quota: 10, remaining: 9, time: 1866 },
  perDay: { quota: 100, remaining: 99, time: 48666 }
}
*/
const clientQuota = HttpResponseHeadersUtils.getClientQuotaLimit(headers);

const orgQuota = HttpResponseHeadersUtils.getOrganizationQuotaLimit(headers);

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 May 2, 2025 08:35
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.

1 participant