How to authorize BigQuery views across projects using the Java Client Library

Google Cloud recently changed their authorized views functionality in the console.

And they broke it!

You can no longer authorize views across projects using the console!

It seems some of their documentation hasn’t been able to keep up either!

Fortunately some of their other documentation is up to date (but there’s a catch):

There is no way to specify views from a different project in the console.

It cannot find the project even if you specify it in the required format: project.dataset.view

When you type in the box, the search results are severely limited.

The views are from the wrong project/dataset and don’t show other options! What to do?

One work around is to use the client libraries:

Take the client library sample code found here:

and modify it:

Replace the variables in the main method:

Then Run it!