I'm using the OAuth 2.0 for TV and Limited-Input Device Applications in my Godot project. The scopes allowed are (https://developers.google.com/identity/protocols/oauth2/limited-input-device?authuser=1#allowedscopes).
OpenID Connect, Google Sign-In
email
openid
profile
Drive API
https://www.googleapis.com/auth/drive.appdata
https://www.googleapis.com/auth/drive.file
YouTube API
https://www.googleapis.com/auth/youtube
https://www.googleapis.com/auth/youtube.readonly
Below is my Godot (gdscript) function to send the request (clientID is a var with my generated OAuth 2.0 Client ID):
func _make_post_request():
var oAuthEntry = "https://oauth2.googleapis.com/device/code";
var params = "scope=email%20profile%20https://www.googleapis.com/auth/youtube&";
params += "client_id=" + clientID;
# Add 'Content-Type' header:
var headers = ["Content-Type: application/x-www-form-urlencoded"]
$HTTPRequest.request(oAuthEntry, headers, true, HTTPClient.METHOD_POST, params)
This works correctly, for the OpenID and YouTube Scopes.
But when I try to use the Drive API Scopes I get an invalid scope return.
For example:
func _make_post_request():
var oAuthEntry = "https://oauth2.googleapis.com/device/code";
var params = "scope=https://www.googleapis.com/auth/drive.appdata&";
params += "client_id=" + clientID;
# Add 'Content-Type' header:
var headers = ["Content-Type: application/x-www-form-urlencoded"]
$HTTPRequest.request(oAuthEntry, headers, true, HTTPClient.METHOD_POST, params)
I get a return of:
{error:invalid_scope}
Does anybody know why the scope is invalid although it is listed on the allowed page (https://developers.google.com/identity/protocols/oauth2/limited-input-device?authuser=1#allowedscopes)