To resolve this error please follow these steps.

blob1476906316235.png


From the Google Admin console go to Security,

blob1476907210653.png


Go to "Show More" then click on "Advanced Settings", then click on "Manage API client access";

blob1476907271343.png


Enter your service account Client ID into the "Client Name" field;

blob1476907434196.png

Then copy and paste these scopes into the "One or More API Scopes" field, then click on Authorize.

   

https://www.googleapis.com/auth/admin.directory.group,
https://www.googleapis.com/auth/admin.directory.orgunit,
https://www.googleapis.com/auth/admin.directory.user,
https://www.googleapis.com/auth/classroom.courses,
https://www.googleapis.com/auth/classroom.courses.readonly,
https://www.googleapis.com/auth/classroom.profile.emails,
https://www.googleapis.com/auth/classroom.profile.photos,
https://www.googleapis.com/auth/classroom.rosters,
https://www.googleapis.com/auth/classroom.rosters.readonly,
https://www.googleapis.com/auth/classroom.coursework.students.readonly,
https://www.googleapis.com/auth/classroom.coursework.me.readonly,
https://www.googleapis.com/auth/classroom.coursework.students,
https://www.googleapis.com/auth/classroom.coursework.me,
https://www.googleapis.com/auth/classroom.student-submissions.students.readonly,
https://www.googleapis.com/auth/classroom.student-submissions.me.readonly