Since today (Tuesday), I've not been able to register any new phones during the API. It fails with a "bad token" exception after entering phone number, but before getting the OTP.
Tried with 5 different phone numbers and two computers with:
public class Main {
public static void main(String[] args) {
System.out.println("Enter the phone number(include the country code prefix, but no +, spaces or parenthesis):");
var scanner = new Scanner(System.in);
var phoneNumber = scanner.nextLong();
Whatsapp.mobileBuilder() // Use the Mobile api
.lastConnection() // Deserialize the last connection, or create a new one if it doesn't exist
.device(CompanionDevice.ios(false)) // Use a non-business iOS account
.unregistered() // If the connection was just created, it needs to be registered
.verificationCodeMethod(VerificationCodeMethod.SMS) // If the connection was just created, send an SMS OTP
.verificationCodeSupplier(() -> { // Called when the OTP needs to be sent to Whatsapp
System.out.println("Enter OTP: ");
var s2 = new Scanner(System.in);
return s2.nextLine();
})
.register(phoneNumber) // Register the phone number asynchronously, if necessary
.join().whatsapp() // Await the result
.addLoggedInListener(api -> System.out.printf("Connected: %s%n", api.store().privacySettings())) // Print a message when connected
.addDisconnectedListener(reason -> System.out.printf("Disconnected: %s%n", reason)) // Print a message when disconnected
.addNewChatMessageListener(message -> System.out.printf("New message: %s%n", message.toJson())) // Print a message when a new chat message arrives
.connect() // Connect to Whatsapp asynchronously
.join(); // Await the result
}
}
Error:
/code: {"reason":"bad_token","status":"fail","login":"xxxxxxxxxx"}
Exception in thread "main" java.util.concurrent.CompletionException: it.auties.whatsapp.exception.RegistrationException: {"reason":"bad_token","status":"fail","login":"xxxxxxxxxx"}
at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:315)
at java.base/java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:320)
at java.base/java.util.concurrent.CompletableFuture$UniCompose.tryFire(CompletableFuture.java:1159)
at java.base/java.util.concurrent.CompletableFuture$Completion.exec(CompletableFuture.java:483)
at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:387)
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1312)
at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1843)
at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1808)
at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:188)
Caused by: it.auties.whatsapp.exception.RegistrationException: {"reason":"bad_token","status":"fail","login":"xxxxxxxxxx"}
at it.auties.whatsapp.registration.WhatsappRegistration.lambda$onCodeRequestSent$15(WhatsappRegistration.java:213)
at it.auties.whatsapp.util.Validate.isTrue(Validate.java:21)
at it.auties.whatsapp.registration.WhatsappRegistration.onCodeRequestSent(WhatsappRegistration.java:213)
at it.auties.whatsapp.registration.WhatsappRegistration.lambda$requestVerificationCode$13(WhatsappRegistration.java:174)
at java.base/java.util.concurrent.CompletableFuture$UniCompose.tryFire(CompletableFuture.java:1150)
... 6 more
Since today (Tuesday), I've not been able to register any new phones during the API. It fails with a "bad token" exception after entering phone number, but before getting the OTP. Tried with 5 different phone numbers and two computers with:
Error: