Saturday, 9 July 2016

Nodejs post photo into google+ album

I have other posts show how to upload images into google drive. However, goole+ album and google drive are different. after a recent update of google drive, it can show google+ album photos. But you can only see them from drive and delete them but you can't add photo from drive and apply the new uploaded images to google+ album automatically.

google-api-nodejs-client does support google+ album. But it is not in google plus api, it is in plus domain api.

Plus domain and plus are different:

the domains API only works on Google Apps for Domains setups, and can't work outside that (e.g. it can't create a post for a domain that is scoped any more widely than that domain). The Domains API is designed for management and onboarding of users on Google+ on a Apps domain. The Google+ API is designed for retrieving public information from Google+, and allowing access to app activities and people in circles for authorised users.

plus domains auth is different:

Every request your application sends to the Google+ API needs to identify your application to Google. For the Google+ Domains API, you should use an OAuth 2.0 access token when you are making calls, as every API call is made on behalf of a given user.

I did a lot research but i can not make it through of the plus domain auth.


I finally found that, actually picasa and google+ album is almost the same thing, and i found picasa has a web api. It is not very recommended but it still works.

Some body made a lib for it:

It is ES6 which only work with nodejs 4.+.

But it is a simple lib you can change it to support nodejs 0.1x.

The only thing you need to take care is the token, it needs access token, and it also need album id, you can get the album id when you access a album by picasa web, the last part of the url is the album id (the penultimate is the user id.)

Again you can go to the autoplayground to manually query one for picasa.

A better way is to use refresh_token.  However, picasa doesn't support refresh_token, so you can create an authentication code for drive and picasa together, then you can do refresh.

No comments:

Post a comment