Google Home Graph API & Limited Connectivity for OAuth

26 Views Asked by At

I am currently working on a personal project that runs in dotnet 8 core. I want to get a list of devices that are setup via Google Home. I have a Google Cloud Project configured, access granted to the HomeGraph API, and I have an OAuth 2.0 Client ID of type TV and Limited Input configured.

I'm working on implementing authentication right now, but when doing the following I get an "Invalid Scope" error back from the API call.

HttpClient client = httpClientFactory.CreateClient();

var content = new FormUrlEncodedContent(new[]
{
    new KeyValuePair<string, string>("client_id", configuration["Google:ClientId"]!),
    new KeyValuePair<string, string>("scope", "https://www.googleapis.com/auth/homegraph")
});

var response = await client.PostAsync("https://oauth2.googleapis.com/device/code", content);
var responseString = await response.Content.ReadAsStringAsync();

I've even tried using a manual approach to OAuth and constructing the URL in attempts to get the authorization code and I still get an invalid scope error from the Google OAuth screen. I have verified this is the correct scope.

0

There are 0 best solutions below