When running the Java quickstart sample at https://developers.google.com/drive/web/quickstart/java?hl=hu in NetBeans, I\'m receiving the error code:
Jun 04,
Basically if you already enabled de Drive API and created credentials.json file at Google Drive API Rest, now you need :
1 - Remove the tokens directory generated in you last execution. In this directory contains a file StoredCredential. 2 - Change de SCOPE to DriveScopes.DRIVE like sample bellow:
private static List SCOPES = Collections.singletonList(DriveScopes.DRIVE);
3 - Re run the program. It will be request that you login in your google account to give the access consent.
4 - It will be generated a new one tokens directory in your project and now with with read and write permissions at google Drive.
This work for me.
I was facing same issue in Eclipse. Here’s a solution:
Run eclipse in admin mode
Clear the directory
C:/Users/<username>.credentials/calendar-java-quickstart.json
Copy the .json file the bin directory, e.g. bin/main/resources/client_secret.json
You are free to run now.