Get authorization tokens
var GoogleAPIsAuthJWT = require('machinepack-googleapisauthjwt');
// Get authorization tokens
GoogleAPIsAuthJWT.authorize({
email: 'service-account-email@developer.gserviceaccount.com',
keyFile: 'path/to/key.pem',
key: 'keyContent',
scopes: [ 'https://www.googleapis.com/auth/drive.readonly' ],
impersonateEmail: 'subject-account-email@example.com',
}).exec({
// An unexpected error occurred.
error: function (err) {
},
// OK.
success: function () {
},
});
Service account email
'service-account-email@developer.gserviceaccount.com'
Path to your generated key.pem
'path/to/key.pem'
Contents of private_key.pem if you want to load the pem file yourself. (do not use the path parameter above if using this param)
'keyContent'
Scopes can be specified either as an array or as a single, space-delimited string
[ 'https://www.googleapis.com/auth/drive.readonly' ]
User to impersonate (leave empty if no impersonation needed)
'subject-account-email@example.com'
An unexpected error occurred.
OK.