Google Classroom API | How add scopes in HTTP request

I want to get a list of courses from an audience by HTTP request, I have set the required areas in the project in Google Cloud, but I still get an error when I try to get the courses.

P.S – Please do not offer me documentation and libraries, do not try to convince me, I just need an HTTP request.

    "error": {
        "code": 403,
        "message": "Request had insufficient authentication scopes.",
        "status": "PERMISSION_DENIED",
        "details": [{
            "@type": "",
            "reason": "ACCESS_TOKEN_SCOPE_INSUFFICIENT",
            "domain": "",
            "metadata": {
                "method": "google.classroom.v1.Courses.ListCourses",
                "service": ""

I tried adding ?scope= to the end of the link
Here is the request template

curl \
  '[YOUR_API_KEY]' \
  --header 'Authorization: Bearer [YOUR_ACCESS_TOKEN]' \
  --header 'Accept: application/json' \

>Solution :

Im going to assume that you are using courses list method

The call should look something like this in raw HTTP Request


Authorization: Bearer [YOUR_ACCESS_TOKEN]
Accept: application/json

The access token ([YOUR_ACCESS_TOKEN]) you are sending must be authorized with the proper scope. If you check the documentation page for the method you are using you will see that you should have authorized the user with one of these scopes

enter image description here

So in your case the error Request had insufficient authentication scopes. means that when you requested authorization you did not request one of the scopes above. There for your access token has insufficient authorization scopes to make the request.

The solution is to reauthorize your user with one of the scopes required by the method in question.

You can read more about how to request authorization and what scopes are in the Using OAuth 2.0 to Access Google APIs documentation page.

Hint: Your very first in the oauth2 flow contains the scope. response_type=code&redirect_uri=http%3A//

This video may help you understand scopes Understanding Google OAuth 2.0 with curl since you appear to be using curl and not just raw HTTP calls.

Leave a Reply