To resolve this error please follow these steps.
From the Google Admin console go to Security,
Go to "Show More" then click on "Advanced Settings", then click on "Manage API client access";
Enter your service account Client ID into the "Client Name" field;
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