patrickdavey
patrickdavey

Reputation: 2076

Trying to access courses.students.list for Google Classroom API

I am trying to access the student list endpoint for Google Classroom.

I have successfully obtained my OAUTH2 token, I have requested the following scopes:

Every time that I try to retrieve the class list I am getting a 403 Permission denied and I'm wondering what I'm doing wrong.

Two things to mention: Here is a screenshot showing the permissions I have granted:

enter image description here

And, interestingly, even after having added the permissions, on the google project page where it lists the number of users using sensitive scopes - it is listed as zero (which is odd, I'd have thought it should be 1)

enter image description here

Any pointers would be really helpful!

Upvotes: 1

Views: 403

Answers (2)

Phil Graetz
Phil Graetz

Reputation: 1

/api/v1/courses/:course_id/students is deprecated.

Instead use: /api/v1/courses/:course_id/users?enrollment_type[]=student

Upvotes: 0

patrickdavey
patrickdavey

Reputation: 2076

Not a very satisfactory answer, but, if I add the https://www.googleapis.com/auth/classroom.rosters.readonly scope, then it allows me access and returns the email addresses at the same time (when calling the v1/courses/{courseId}/students endpoint)

If however you only have the rosters scope, then you can still access the v1/courses/{courseId}/students endpoint, but, you just don't get the email addresses returned.

Quite confusing to me.

Upvotes: 1

Related Questions