403 Request had insufficient authentication scopes

While trying to replicate the very first Python notebook locally I’ve got this error.

google.api_core.exceptions.PermissionDenied: 403 Request had insufficient authentication scopes. [reason: "ACCESS_TOKEN_SCOPE_INSUFFICIENT"
domain: "googleapis.com"
metadata {
  key: "service"
  value: "generativelanguage.googleapis.com"
}
metadata {
  key: "method"
  value: "google.ai.generativelanguage.v1beta.ModelService.ListModels"
}
]

The code in question.

 #!/usr/bin/env python
  
import google.generativeai as palm
  
palm.configure()
  
for m in palm.list_models():
    print(m)

I went to Google Cloud console and enabled Generative Language API, but I am still getting the same error.

With this invocation, the API uses Application Default Credentials (ADC) for which there is this issue support application default credentials · Issue #8 · google/generative-ai-python · GitHub

Now trying to see if I have enabled API scopes https://www.googleapis.com/auth/generative-language and https://www.googleapis.com/auth/cloud-platform for it.