use of POGOProtos.Networking.Responses.VerifyChallengeResponseOuterClass.VerifyChallengeResponse in project PokeGOAPI-Java by Grover-c13.
the class PokemonGo method verifyChallenge.
/**
* Verifies the current challenge with the given token.
*
* @param token the challenge response token
* @return if the token was valid or not
* @throws RequestFailedException if an exception occurred while sending requests
*/
public boolean verifyChallenge(String token) throws RequestFailedException {
hasChallenge = false;
VerifyChallengeMessage message = VerifyChallengeMessage.newBuilder().setToken(token).build();
ServerRequest request = new ServerRequest(RequestType.VERIFY_CHALLENGE, message);
ByteString responseData = getRequestHandler().sendServerRequests(request, true);
try {
VerifyChallengeResponse response = VerifyChallengeResponse.parseFrom(responseData);
hasChallenge = !response.getSuccess();
if (!hasChallenge) {
challengeURL = null;
synchronized (challengeLock) {
challengeLock.notifyAll();
}
}
return response.getSuccess();
} catch (InvalidProtocolBufferException e) {
throw new RequestFailedException(e);
}
}
Aggregations