Skip to content

Added Support for Limit M2M Auth API#1107

Merged
tanya732 merged 8 commits into
masterfrom
sdk-5935-Limit-M2M-Authentication-API-Support
May 29, 2025
Merged

Added Support for Limit M2M Auth API#1107
tanya732 merged 8 commits into
masterfrom
sdk-5935-Limit-M2M-Authentication-API-Support

Conversation

@tanya732
Copy link
Copy Markdown
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
Comment thread src/lib/httpResponseHeadersUtils.ts Outdated
Comment thread src/lib/httpResponseHeadersUtils.ts Outdated
kushalshit27
kushalshit27 previously approved these changes May 28, 2025
@tanya732 tanya732 merged commit a62b620 into master May 29, 2025
8 checks passed
@tanya732 tanya732 deleted the sdk-5935-Limit-M2M-Authentication-API-Support branch May 29, 2025 07:22
@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