I am trying to use server authentication for a server through the Google Calendar API. The documentation mentions that you can impersonate the user. I added the owner rights to the account that I want to issue, and made sure that domain delegation is enabled. From all that I read, "user @example" should specify an impersonator, but it does not work. I have all the functions of creating events, etc., but I can not get it from email, except for a randomly created Google.
var google = require('googleapis');
var calendar = google.calendar('v3');
var scopes = ['https://www.googleapis.com/auth/calendar'];
var key = require ('./xxx.json');
console.log("Calendar Service connected");
var jwtClient = new google.auth.JWT(
key.client_email,
null,
key.private_key,
scopes,
'user@example.com'
);
jwtClient.authorize(function(err, token) {
if(err) {
}
console.log('token',token);
});
module.exports = {};
Thanks for any help !!
source
share