Skip to content
Advertisement

Using google photos API in 2023

Does anyone have an example of how to use the google photos API in 2023? I’m specifying the year because if I try to search for documentation for this, I end up on a photos.get (from google) with sample code that when I run it, gives me an error that the documented approach is already deprecated:

JavaScript

I’m trying to figure out how to use this API endpoint in Javascript to access the contents of a public Google Photos album:

https://photoslibrary.googleapis.com/v1/albums/{albumId}

It seems for public album this should be fairly straight-forward. But so far it looks like oauth is needed, even to access something like a public photo album.

Is it really this hard?

Advertisement

Answer

The issue you are having is that the sample you are using is from the old JavaScript signin/authorization library.

Google has split that up now you need to use Authorizing for Web as you can guess google has a lot of samples to be updated. I doubt they have updated everything.

I have a QuickStart created. Make sure that you create web application credentials on google developer console and create an api key.

JavaScript

public album.

The thing is you say your after public albums, if the album is in fact public then you should be able to get away with just using the api key. You should only need to be authorized if its private user data.

Update: after a bit of digging im not even sure this library will allow you to only login with an api key with out sending a valid client id. I have sent an email off to the Identity team to see if they have something they can share.

Update:

I got a message back from the team:

A client ID is required even to access content the user has made available to everyone.

So even if the data is public you will have to register a client id and request permissions of the user.

Advertisement