-
Notifications
You must be signed in to change notification settings - Fork 22
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
Warning when using incorrect token. #5
Comments
I'm unsure how one would go about implementing this. Afaik, there isn't an endpoint you can call to verify the validity of the token. I'll ask the API dev at DBL. |
There would be a 401 unauthorized response if an invalid token is used. No? |
Well yeah, but what would it call to receive that response? |
maybe throw an exception when the user attempts to update stats? |
Oh, I'm so sorry - I totally misread your initial issue. I believed you meant that you wanted it to validate the token upon building the API client. Since the entire API client is async, you need to handle the exception async or transform the CompletionStage into a CompletableFuture and use the blocking int serverCount = 1234;
api.setStats(serverCount).whenComplete((v, e) -> {
// if e is not null, then there was an exception
});
try {
api.setStats(serverCount).toCompletableFuture().get();
} catch(Exception e) {
// exception
} |
When you attempt to set the stats of your bot with an invalid token, there is no indication that your token is invalid. It would be helpful to know whether or not the token is working or not.
The text was updated successfully, but these errors were encountered: