Pretend to be a user using the Google Maps API oauth2 account (node.js)

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'); // private 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(err);
  }
  console.log('token',token);
  //listCalendars(jwtClient);
});

module.exports = {};

Thanks for any help !!

+4
source share
1 answer

, . :

1), 2) 3), , **: admin api

0

Source: https://habr.com/ru/post/1684876/


All Articles