GOOGLE_APPLICATION_CREDENTIALS alternatives

I couldn’t set GOOGLE_APPLICATION_CREDENTIALS variable on a production server environment that runs a Java war application under a Jboss Wildfly 9 server.

I tried setting at .bashrc, .profile, .bash_profile. I tried even include the variable on standalone.sh. Nothing.

So, I remember that the GoogleCredentials function acepts a FileInputStream that reads the path of the json file.

FirebaseOptions options = FirebaseOptions.builder()
			    .setCredentials(GoogleCredentials.fromStream(new FileInputStream(<<path>>)))
			    .build();

So, after two days, finally, it works.

The solution’s explanation is here.

Leave a Reply

Your email address will not be published. Required fields are marked *