Skip to content
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

Allow Refresh/Update of Management Api Token #131

Closed
sean-91 opened this issue Jun 14, 2018 · 1 comment
Closed

Allow Refresh/Update of Management Api Token #131

sean-91 opened this issue Jun 14, 2018 · 1 comment

Comments

@sean-91
Copy link

sean-91 commented Jun 14, 2018

As it stands there appears to be no easy way to refresh the apiToken of a ManagementApi. Since the token used here has an expiration, a new ManagementApi requires instantiating with a new valid token when this occurs.

The problem arises with the use of the OkHttpClient instantiated with a ManagementApi. This leads to a memory leak, as each successive ManagementApi creates a new OkHttpClient that is never cleaned up.

A similar issue was addressed here: square/okhttp#2846

A setter for the apiToken would alleviate this issue, allowing it to be updated without the need to re-instantiate the ManagementApi

@lbalmaceda
Copy link
Contributor

Yes, that makes sense. Thanks for raising this up. The new api token would be used on the next call to any of the entities' methods, since it's passed on that call e.g. https://github.com/auth0/auth0-java/blob/master/src/main/java/com/auth0/client/mgmt/ManagementAPI.java#L160

@lbalmaceda lbalmaceda added this to the v1-Next milestone Jul 3, 2018
@lbalmaceda lbalmaceda removed this from the v1-Next milestone Jul 13, 2018
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

No branches or pull requests

2 participants