title: How to get application_default_credentials using service account?
body: <p>I have a maven plugin which uses <code>application_default_credentials.json</code> file to authenticate against google cloud services. </p>
  
  <p>I am trying to figure out to get default credential using service account instead of using my account.</p>
  
  <p>I tried setting <code>GOOGLE_APPLICATION_CREDENTIALS</code> environment variable to the path of service account's credential file. But, the plugin does not use this environment variable.</p>
  
  <p>I know, it might be a problem with the plugin. But, I am wondering is there any way to set <code>application-default-credentials.json</code> using google service account.</p>
  
  <p>format of application-default-credentials.json:</p>
  
  <pre><code>{
    "client_id": "76....408.apps.googleusercontent.com",
    "client_secret": "d-....D0Ty",
    "refresh_token": "1/r............................emnY02",
    "type": "authorized_user"
  }
  </code></pre>
  
  <p>Service account's key format:</p>
  
  <pre><code>{
    "type": "service_account",
    "project_id": "ID",
    "private_key_id": "9a4.................................bbaad80",
    "private_key": "-----BEGIN PRIVATE KEY-----\nMI................................e\n-----END PRIVATE KEY-----\n",
    "client_email": "name@project.iam.gserviceaccount.com",
    "client_id": "10..................886",
    "auth_uri": "https://accounts.google.com/o/oauth2/auth",
    "token_uri": "https://oauth2.googleapis.com/token",
    "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
    "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/name%40project.iam.gserviceaccount.com"
  }
  </code></pre>