Search code examples
google-cloud-platformoauth-2.0

Error 400: invalid_scope with Postman and Google OAuth2


I am attempting to authenticate via Google's OAuth2 service to pull data from Google Analytics in an application. I want to start by getting this all set up in Postman but I cannot seem to get the scope parameter for OAuth2 right. I've had a look at a few resources but it seems that they are either outdated, or don't work at all - I keep getting Error 400: invalid_scope.

The age old error

The GCP scope is all good

My Postman config for OAuth2 is as per the documentation. The full truncated scope in the image reads as https://wwww.googleapis.com/auth/analytics.readonly

Any ideas? Am I making an obvious error here?

I've tried defining the Scope in several ways - in quotes, brackets for an array, as a full object with an array of scopes but none of those work. I also don't believe that it's the right approach anyway as the error message wraps this in an array already.

I've also enabled the Ads API to try and see if this was specific to the Google Analytics API but with no luck.


Solution

  • You have four ws in the scope (wwww). Change to www.