const { google } = require('googleapis');
const key = require('./credentials.json');
const scopes = [
  'https://www.googleapis.com/auth/admin.directory.user',
  // 'https://www.googleapis.com/auth/apps.licensing'
];
const subadress = 'hogehoge@test.jp';
const jwtClient = new google.auth.JWT(
  key.client_email,
  null,
  key.private_key,
  scopes,
  subadress,
);

jwtClient.authorize();
const adminDirectory = google.admin({ version: 'directory_v1', auth: jwtClient });
const requestBodyStr = JSON.stringify(requestBody)
try {
  adminDirectory.users.insert({
    requestBody: {
      name: {
        familyName: "ykimura",
        givenName: "test"
      },
      password: "allforone",
      primaryEmail: "hogehoge@test.jp"
    },
  })
} catch (err) {
  console.log(err.message);
}