{"id":450,"date":"2022-06-03T14:59:44","date_gmt":"2022-06-03T14:59:44","guid":{"rendered":"https:\/\/sidroniolima.com.br\/blog\/?p=450"},"modified":"2022-06-03T14:59:48","modified_gmt":"2022-06-03T14:59:48","slug":"google_application_credentials-alternatives","status":"publish","type":"post","link":"https:\/\/sidroniolima.com.br\/blog\/2022\/06\/03\/google_application_credentials-alternatives\/","title":{"rendered":"GOOGLE_APPLICATION_CREDENTIALS alternatives"},"content":{"rendered":"\n<div class=\"twitter-share\"><a href=\"https:\/\/twitter.com\/intent\/tweet?via=sidroniolima\" class=\"twitter-share-button\">Tweet<\/a><\/div>\n\n<p>I couldn&#8217;t set GOOGLE_APPLICATION_CREDENTIALS variable on a production server environment that runs a Java war application under a Jboss Wildfly 9 server.<\/p>\n<p>I tried setting at .bashrc, .profile, .bash_profile. I tried even include the variable on standalone.sh. Nothing.<\/p>\n<p>So, I remember that the GoogleCredentials function acepts a FileInputStream that reads the path of the json file.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>FirebaseOptions options = FirebaseOptions.builder()\n\t\t\t    .setCredentials(GoogleCredentials.fromStream(new FileInputStream(&lt;&lt;path>>)))\n\t\t\t    .build();<\/code><\/pre>\n\n\n\n<p>So, after two days, finally, it works.<\/p>\n<p>The solution&#8217;s explanation is <a href=\"https:\/\/cloud.google.com\/docs\/authentication\/production#auth-cloud-explicit-java\">here<\/a>.<\/p>\n\n<div class=\"twitter-share\"><a href=\"https:\/\/twitter.com\/intent\/tweet?via=sidroniolima\" class=\"twitter-share-button\">Tweet<\/a><\/div>\n","protected":false},"excerpt":{"rendered":"<p>I couldn&#8217;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 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1],"tags":[29],"class_list":["post-450","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-java"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/sidroniolima.com.br\/blog\/wp-json\/wp\/v2\/posts\/450","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sidroniolima.com.br\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sidroniolima.com.br\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sidroniolima.com.br\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sidroniolima.com.br\/blog\/wp-json\/wp\/v2\/comments?post=450"}],"version-history":[{"count":1,"href":"https:\/\/sidroniolima.com.br\/blog\/wp-json\/wp\/v2\/posts\/450\/revisions"}],"predecessor-version":[{"id":451,"href":"https:\/\/sidroniolima.com.br\/blog\/wp-json\/wp\/v2\/posts\/450\/revisions\/451"}],"wp:attachment":[{"href":"https:\/\/sidroniolima.com.br\/blog\/wp-json\/wp\/v2\/media?parent=450"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sidroniolima.com.br\/blog\/wp-json\/wp\/v2\/categories?post=450"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sidroniolima.com.br\/blog\/wp-json\/wp\/v2\/tags?post=450"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}