auth0 / auth0-java

Java client library for the Auth0 platform
https://auth0.com
MIT License
281 stars 130 forks source link

Add support for sessions and refresh-tokens for Users in the Management API #653

Open jak opened 1 week ago

jak commented 1 week ago

Checklist

Describe the problem you'd like to have solved

I'd like to access these resources:

Describe the ideal solution

Something like:

managementAPI.users().listSessions()
managementAPI.users().listRefreshTokens()
managementAPI.users().deleteSessions()
managementAPI.users().deleteRefreshTokens()

It'd require a Session entity being added, and likely a RefreshToken entity. The API puts refresh tokens in an array called sessions but it is not look like the same entity from the documented schema.

Alternatives and current workarounds

No response

Additional context

No response

jak commented 1 week ago

I'm looking at creating a PR here. According to the docs, the sessions and refresh tokens URLs do not support "classic" pagination, only the "next"/"take" approach which seems to be called checkpoint pagination in the code base. The current codebase doesn't seems to support a pagination concept without the properties start/length/total and limit. The "next" property is always consumed in addition.

My suggestion is to not use the Page abstract in these instances, as they add a number of properties that are not expected to be on the responses.

Is that approach acceptable?