Hi. I'm wondering if there's any way to configure authentication with more than one one project? (e.g. both project-1-key.json and project-2-key.json). I have a query that needs to do a join between two projects (which we can do on the BigQuery interface). However It seems each api endpoint only allows for a single auth config. I did try configuring the global gcloud with project-1 and the bigquery config with project-2. But second config seems to take preference and I still get Access Denied: Table table-name:project-1
TLDR, I'm wondering if there's a way to achieve something like the following:
var config = {
projectId: ['project-1', 'project-2'],
keyFilename: ['/path/to/project-1-key.json', '/path/to/project-2-key.json']
};
Hmm, very interesting question! @jgeewax @omaray any ideas if such a query is possible from a service account?
Ok, I think I figured a better way around. Seems from inside the second project, you can add the service accounts from other projects as members/roles. So you want to give it the email of project-1's service account (the one used for auth in the config).

Which essentially does this...
https://cloud.google.com/iam/docs/granting-roles-to-service-accounts
Thanks for sharing! I'll add it to our FAQ.
This issue was moved to GoogleCloudPlatform/gcloud-common#191
Great suggestion!! I was kind struggling a little with this point!
Most helpful comment
Ok, I think I figured a better way around. Seems from inside the second project, you can add the service accounts from other projects as members/roles. So you want to give it the email of project-1's service account (the one used for auth in the config).
Which essentially does this...
https://cloud.google.com/iam/docs/granting-roles-to-service-accounts