go-auth0 icon indicating copy to clipboard operation
go-auth0 copied to clipboard

Support Custom TokenSource

Open oleavister opened this issue 3 months ago • 1 comments

Checklist

Describe the problem you'd like to have solved

We'd like the Auth0 SDK for the management API client to support using a custom token source. We would like to use our own token source so that we can more intelligently acquire tokens across multiple servers from a cache. This would in turn mean that we can use fewer M2M tokens and help us to stay under our M2M quota, as well as reducing the burden on the authorization server.

The issue is that the management does not support setting your own TokenSource. It does have various With options for setting token source such as WithClientCredentials: https://github.com/auth0/go-auth0/blob/main/management/management_option.go. This internally is used to configure the token source here: https://github.com/auth0/go-auth0/blob/main/management/management.go#L188-L195.

Describe the ideal solution

I am proposing that a new WithTokenSource option be added. If a token source is provided via this functional option, then use this when making requests. I can put up a PR for this work if it's helpful.

Alternatives and current workarounds

No response

Additional context

No response

oleavister avatar Oct 06 '25 20:10 oleavister

Hi @oleavister,

I’ll review this feature request and follow up with you once I have an update.

developerkunal avatar Oct 09 '25 11:10 developerkunal