Search code examples
google-apigoogle-authenticationlooker-studio

View report using an access token


I'm building a web application that embeds a data studio report. The challenge I'm running into is that I would like to allow access to the report only from inside the web application. For this, what I have in mind is not to share the report and view the embedded report using an access token.

The documentation here explains that when calling google apis, you can attach the access token as a query parameter. This type of solution has worked with files from google drive; however, there is no official api to get a data studio report so I thought that maybe by calling the embedded link or the preview link and attaching the access token as a query param would do the trick, but it doesn't.

For example, let's say that the embedded url is:
https://datastudio.google.com/embed/reporting/0BxscwH5YAPRRMVRWYTZVOMMptbVk/page/m2YH

If I attempt to reach that url in the browser while logged in to google with the user who is authorized to view the report, I get the data.

If I try to reach that url in the browser while logged in to google with a user who DOES NOT has access to view the report, I get a message saying that is not authorized... which is expected.

Now, I followed the steps right here and I was able to get an access token. I tried calling the url: https://datastudio.google.com/embed/reporting/0BxscwH5YAPRRMVRWYTZVOMMptbVk/page/m2YH?access_token=y29.jADSFhkjce0asdfaMDFaso but it doesn't work.

There is no documentation explicitly saying this should work. I'm just trying to overcome this challenge I'm facing. Does anyone knows if there is a way to accomplish this?

P.S. I also tried with a an access token that includes the drive api scope to no avail.


Solution

  • The only solutions so far is to implement Row Level Filtering. Basically, this solution consists of implementing your own authentication mechanism and your own data display based on the token. Implementing a tutorial step by step is very time consuming but the documentation contains all the details at a high level. That should be enough to get you started.