1

I'm trying to work with Google photos API. When trying to access the cloud, the following exception thrown:

Exception in thread "main" com.google.api.gax.rpc.UnavailableException: io.grpc.StatusRuntimeException: UNAVAILABLE: Credentials failed to obtain metadata

and further error is:

Caused by: com.google.api.client.http.HttpResponseException: 401 Unauthorized

I don't really understand why authorization doesn't work with Google photos API, as I created project in API console and enabled Google photos API using google 'quick start' page, successfully passed all authorization process with a cloud (tokens file created). The PhotosLibraryClient successfully acquired, but if I try to do some action on cloud (to list albums, for example) the exception above thrown. The thing is interesting, as I have in my project module that works with Gmail API and it does succeed doing actions on Gmail cloud (like deleting and sending mails). Please advise

  • Welcome to Stack Overflow. Could you please post some of your code that has lead you to this error? – kdpnz Apr 06 '20 at 00:54
  • 1
    Thank you @kdpnz. The code is very trivial, every access to Photos API throws the error, like these ones: `Album createdAlbum = photosLibraryClient.createAlbum(albumName);` `ListAlbumsPagedResponse albumsResponse = photosLibraryClient.listAlbums();` The Photos API enabled in API console, so I don't really know what else must be done. – Anton Olsson Apr 07 '20 at 09:10
  • I am facing the exact same problem. Weirder still, it worked previously. Now, I created a new token and am facing this 401 error. – martin Dec 18 '20 at 05:23

0 Answers0