May 29, 2020
403 error with 'Request had insufficient authentication scopes.' as message insufficientPermissions
by trying to send email from my gmail account with below code (which provided in https://developers.google.com/gmail/api/v1/reference/users/messages/send) i got error, with error code 403, message 'Request had insufficient authentication scopes.' and reason is like 'insufficientPermissions'
what should i do, need some quick help
sendEmail(userId, email, callback) { // Using the js-base64 library for encoding:// https://www.npmjs.com/package/js-base64
gapi.load('client:auth2', () => {
gapi.client.load('gmail', 'v1', () => {
console.log('Loaded Gmail');
let base64EncodedEmail = Base64.encodeURI(email);
let request = gapi.client.gmail.users.messages.send({
'userId': userId,
'resource': {
'raw': base64EncodedEmail
}
});
request.execute(callback);
});
})
}
Details
Community content may not be verified or up-to-date. Learn more.