I’m writing a maintenance script to audit our OAuth client configurations across multiple orgs. The goal is simple: list all clients and verify their assigned scopes against a baseline policy.
I’m using the @genesyscloud/authorization-client Node.js SDK. The getAuthorizationClients method works fine for the first page, but I’m hitting a wall when trying to paginate through the results. The response object doesn’t seem to expose a standard nextPageToken or paginationNext property like other list endpoints do.
Here’s the basic flow I’ve got so far:
const authClient = new GenesysCloud.AuthClient();
await authClient.authenticate({
client_id: process.env.CLIENT_ID,
client_secret: process.env.CLIENT_SECRET
});
const result = await authClient.getAuthorizationClients({
expand: ['scopes'] // Need scopes included
});
console.log('First page count:', result.entities.length);
// How do I get the next page?
// result.paginationNext is undefined
I checked the raw HTTP response by swapping to a direct axios call to GET /api/v2/authorization/clients?expand=scopes. The response headers include a Link header with rel="next", but the SDK wrapper seems to swallow this or not parse it into a usable cursor.
Is there a specific method I’m missing on the SDK client to handle this pagination? Or do I need to manually parse the Link header from the underlying axios response?
Also, when I do fetch the subsequent pages, the expand=scopes parameter sometimes seems to get dropped in the retry logic if I implement manual cursor tracking. The second page comes back with empty scope arrays for clients that definitely have scopes assigned.
I’ve tried passing page_size=100 but that just reduces the number of calls, it doesn’t solve the missing cursor issue.
Anyone else hit this with the JS SDK? It feels like an oversight in the client wrapper since every other entity (users, teams, queues) has a clean paginationNext property.