-
Notifications
You must be signed in to change notification settings - Fork 133
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 to update the Management API token #141
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- 2.18.0
- 2.17.0
- 2.17.tmp
- 2.16.0
- 2.15.0
- 2.14.0
- 2.13.0
- 2.12.0
- 2.11.0
- 2.10.1
- 2.10.0
- 2.9.0
- 2.8.0
- 2.7.0
- 2.6.1
- 2.6.0
- 2.5.0
- 2.4.0
- 2.3.0
- 2.2.0
- 2.1.0
- 2.0.0
- 2.0.0-beta.2
- 2.0.0-beta.1
- 2.0.0-beta.0
- 1.45.1
- 1.45.0
- 1.44.2
- 1.44.1
- 1.44.0
- 1.43.0
- 1.42.0
- 1.41.0
- 1.40.2
- 1.40.1
- 1.40.0
- 1.39.0
- 1.38.0
- 1.37.0
- 1.36.1
- 1.36.0
- 1.35.0
- 1.34.1
- 1.34.0
- 1.33.0
- 1.32.0
- 1.31.0
- 1.30.0
- 1.29.0
- 1.28.1
- 1.28.0
- 1.27.0
- 1.26.0
- 1.25.0
- 1.24.0
- 1.23.0
- 1.22.1
- 1.22.0
- 1.21.0
- 1.20.0
- 1.19.0
- 1.18.0
- 1.17.0
- 1.16.0
- 1.15.0
- 1.14.3
- 1.14.2
- 1.14.1
- 1.14.0
- 1.13.3
- 1.13.2
- 1.13.1
- 1.13.0
- 1.12.0
- 1.11.0
- 1.10.0
- 1.9.1
- 1.9.0
- 1.8.0
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,16 +15,17 @@ | |
public class ManagementAPI { | ||
|
||
private final HttpUrl baseUrl; | ||
private final String apiToken; | ||
private String apiToken; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't know if |
||
private final OkHttpClient client; | ||
private final TelemetryInterceptor telemetry; | ||
private final HttpLoggingInterceptor logging; | ||
|
||
/** | ||
* Create an instance with the given tenant's domain and API token. | ||
* See the Management API section in the readme or visit https://auth0.com/docs/api/management/v2/tokens to learn how to obtain a token. | ||
* | ||
* @param domain the tenant's domain. | ||
* @param apiToken the token to authenticate the calls with. See the "Getting an API token" section to learn how to obtain a token. | ||
* @param apiToken the token to authenticate the calls with. | ||
*/ | ||
public ManagementAPI(String domain, String apiToken) { | ||
Asserts.assertNotNull(domain, "domain"); | ||
|
@@ -45,6 +46,18 @@ public ManagementAPI(String domain, String apiToken) { | |
.build(); | ||
} | ||
|
||
/** | ||
* Update the API token to use on new calls. This is useful when the token is about to expire or it already has. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "when the token is about to expire or already has" There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I had doubts on this one 😛 |
||
* Please note you'll need to obtain the correspondent entity again for this to apply. e.g. call {@link #clients()} again. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "corresponding" |
||
* See the Management API section in the readme or visit https://auth0.com/docs/api/management/v2/tokens to learn how to obtain a token. | ||
* | ||
* @param apiToken the token to authenticate the calls with. | ||
*/ | ||
public void setApiToken(String apiToken) { | ||
Asserts.assertNotNull(apiToken, "api token"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I might be wrong but it looks like you've got these params backwards? http://junit.sourceforge.net/javadoc/org/junit/Assert.html#assertNotNull(java.lang.Object) I'm not sure if There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think I'm wrong ... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes! if (value == null) {
throw new IllegalArgumentException(String.format("'%s' cannot be null!", name));
} BTW. At the top of the class you can see the imports and in this case, that I'm importing this lib |
||
this.apiToken = apiToken; | ||
} | ||
|
||
/** | ||
* Avoid sending Telemetry data in every request to the Auth0 servers. | ||
*/ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awkward .... consider: