No longer able to obtain OAuth2 Access Token: invalid_scope error

Viewed 1319

I have written a mobile application using the React Native Framework.

This application uses Google's OAuth 2.0 endpoints to authorize access to Google APIs.

I followed the documentation to implement this.

I have been able to retrieve Access Tokens and Refresh tokens for months now by making the following HTTP requests:

HTTP GET Request to retrieve Authorization Code:

https://accounts.google.com/o/oauth2/v2/auth?scope=email%20profile%20https://www.googleapis.com/auth/youtube%20https://www.googleapis.com/auth/yt-analytics.readonly%20https://www.googleapis.com/auth/yt-analytics-monetary.readonly%20https://www.googleapis.com/auth/youtubepartner&response_type=code&client_id=OMITTED&redirect_uri=OMITTED');

HTTP POST Request to exchange Authorization Code for Access Token:

let queryString = "code=" + authCode + "&" + "client_id=OMITTED&redirect_uri=OMITTED&grant_type=authorization_code";

fetch('https://www.googleapis.com/oauth2/v4/token', {method:'POST', headers: {'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8' }, body: queryString})

This POST Request is now getting the following error within the response:

Error:

"invalid_scope"
error_description
:
"Some requested scopes were invalid. {valid=[https://www.googleapis.com/auth/userinfo.email, https://www.googleapis.com/auth/userinfo.profile, https://www.googleapis.com/auth/youtube, https://www.googleapis.com/auth/yt-analytics.readonly, https://www.googleapis.com/auth/yt-analytics-monetary.readonly], invalid=[https://www.googleapis.com/auth/youtubepartner#]}"

Again, I have been able to retrieve an Access Token and Refresh Token for months using this same code.

This error has suddenly been surfacing as of 09/12/2018.

There have been no changes to my code.

Does anyone have any ideas regarding why I am now getting this error?

1 Answers

What about removing the email scope?


I guess Google has fixed it now. I can signing-in without removing email scope now on my app.

Related