node.js - Creating Google Calendar Events using API doesn't create Hangout link -


i've been successful far in hacking googleapis , gapitoken packages create events on google calendar via api. point of find way programmatically generate google hangout link, cannot via api, far know. according this post, supposed able enable automatic creation of hangout links when creating events, have done account.

the code using going run node.js, there no user-facing portion. using service account technique authenticate via oauth2.0. seems work fine, except event created contains no property called 'hangoutlink'. ideas?

var moment = require('moment'); var googleapis = require('googleapis'); var googletoken = require('gapitoken'); var oauth2client = googleapis.oauth2client;  var token = new googletoken({     iss: '*******************@developer.gserviceaccount.com',     scope: 'https://www.googleapis.com/auth/calendar',     keyfile: './*****************.pem' }, function (err) {     if (err) {         return console.log(err);     }      token.gettoken(function (err, token) {         if (err) {             return console.log(err);         }          googleapis.load('calendar', 'v3', function (err, client) {             var oauthclient = new oauth2client('', '', '', {}, {                 token_type: 'bearer',                 access_token: token             });              var = moment().format();              client                 .calendar                 .events                 .insert({                     calendarid: 'primary',                     resource: {                         summary: 'hangout',                         description: 'hangout',                         reminders: {                             overrides: {                                 method: 'popup',                                 minutes: 0                             }                         },                         start: {                             datetime:                         },                         end: {                             datetime:                         },                         attendees: [{                             email: '****@**********.com'                         }]                     }                 })                 .withauthclient(oauthclient)                 .execute(function (err, event) {                     // event not contain hangoutlink                     console.log(event.hangoutlink);                 });         });     }); }); 

this isn't complete solution, i've had partial success changing constraints little bit. auto-creation of hangout links events seems account-specific setting, not calendar specific setting. means using service account model create events doesn't trigger hangout creation, because don't (as far can tell) have way turn on auto-create-hangouts on google accounts created in service account model.

to test theory, put oauth-based version gets traditional google account token. looks this: https://gist.github.com/drewww/5665130

it's more or less same example, except sort of token being used. in callback, hangoutlink reliably populated.

obviously, not clean in example. depends on traditional oauth flow, , user creating events must have auto-create hangout turned on in personal account settings. highly inconvenient user experience perspective. i'm going try creating dummy google account , having own hangouts.


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -