Issue in Migrate from legacy FCM APIs to HTTP v1

Hello I am facing issue during upgrade fcm by following https://firebase.google.com/docs/cloud-messaging/migrate-v1#linux-or-macos guide.
we have facing issue to access token when trigger

googleCredentials.refresh();

function

private static String getAccessToken() throws IOException {
  GoogleCredentials googleCredentials = GoogleCredentials
          .fromStream(new FileInputStream("service-account.json"))
          .createScoped(Arrays.asList(SCOPES));
  googleCredentials.refresh();
  return googleCredentials.getAccessToken().getTokenValue();
}

I do not understand how this relates to the Openfire project.