I'm trying to use Gmail API using Java, and for the beginning, I tried to run the following script: https://github.com/googleworkspace/java-samples/blob/master/gmail/quickstart/src/main/java/GmailQuickstart.java
I've downloaded the credential needed and installed relevant Google packages. (I hope I didn't mess up with this, an incorrect version, etc...)
I manage to get to the line:
AuthorizationCodeInstalledApp credential1 = new AuthorizationCodeInstalledApp(flow, receiver);
the default browser opens up and I give access permissions, But right afterward in the line:
Credential credential2 = credential1.authorize("User");
it throws the following exception as shown in the attached file. (I changed the line a bit, in order to understand what part of the original line threw the exception, my code is as shown in the file attached, it is the only difference)
Do you have any idea what to do?
Thank you!!