Saturday 8 April 2017

Post to google+ wall from plusDomains api

I'm trying to post to my google+ wall from the api. I have gone through and granted the correct OAuth scopes and appropriately enabled the plusDomains Api on my console but I am still getting a 403 error.

                    var google = require('googleapis')
                    var auth = new google.auth.OAuth2();

                    auth.setCredentials({
                        access_token: accessToken
                    });
                    google.plusDomains('v1').activities.insert({
                        userId: 'me',
                        body : {
                             'object' : {
                                 'originalContent' : 'foo'
                             },
                             'access' : {
                                 'items' : [{
                                     'type' : 'domain'
                                 }],
                                 'domainRestricted': "true"
                             }
                     },
                         auth: auth
                     }, function (err, response) {
                     if (err) {
                         console.error(err)
                         res.send(err.code, err)
                     } else {
                         console.log(response)
                         res.send(200)
                     }
                     });



via immexerxez

No comments:

Post a Comment