I am using the Java Client Library to handle Google authentication for my app. Below is the code to handle the authentiation. It is almost exactly the same as the code featured on the Java quickstart, but it does not work. After I sign in and dismiss the unverified screen, I get a "Something went wrong, try again later" screen. There are no error messages on the terminal and it is repeatedly happening. I have already checked that both my credentials.json file and tokens folder are working as expected. I have also made sure the scopes match up between the Cloud Console and the List SCOPES. Any help is greatly appreciated!
public static Credential getCredentials(NetHttpTransport httpTransport) throws IOException {
// Load client secrets from credentials.json
InputStream inputStream = new FileInputStream(CREDENTIALS_PATH);
GoogleClientSecrets clientSecrets = GoogleClientSecrets.load(JSON_FACTORY, new InputStreamReader(inputStream));
// Build and trigger authentication request
GoogleAuthorizationCodeFlow flow = new GoogleAuthorizationCodeFlow
.Builder(httpTransport, JSON_FACTORY, clientSecrets, SCOPES)
.setDataStoreFactory(new FileDataStoreFactory(new File(TOKENS_PATH)))
.build();
// Create credential object
Credential credential = new AuthorizationCodeInstalledApp(flow, new LocalServerReceiver()).authorize("user");
System.out.println("Successfully authorized: " + credential.getAccessToken());
// Return authorized Credential object
return credential;
}