I'm trying to get the list of courses of a specefic teacher. I did like that:
String courseId = "64294889578";
ListTeachersResponse response = service1.courses().teachers().list(courseId)
.setPageSize(100)
.setPageToken(pageToken2)
.execute();
I got that error:
Exception in thread "main" com.google.api.client.googleapis.json.GoogleJsonResponseException: 403 Forbidden { "code" : 403, "errors" : [ { "domain" : "global", "message" : "Insufficient Permission", "reason" : "insufficientPermissions" } ], "message" : "Request had insufficient authentication scopes.", "status" : "PERMISSION_DENIED" } at com.google.api.client.googleapis.json.GoogleJsonResponseException.from(GoogleJsonResponseException.java:150) at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:113) at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:40) at com.google.api.client.googleapis.services.AbstractGoogleClientRequest$1.interceptResponse(AbstractGoogleClientRequest.java:321) at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:1067) at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:419) at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:352) at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:469) at se.edt.classroom.ClassroomQuickstart.main(ClassroomQuickstart.java:86)
So I tried changing the scope defined by
private static final List<String> SCOPES =
Collections.singletonList(ClassroomScopes.CLASSROOM_GUARDIANLINKS_ME_READONLY);
to all existing scopes for example CLASSROOM_COURSES
, but no success.
Have you please any idea about solving that ?. Big thanks