I am unable to get the Agent User Id which is necessary to execute any request in the Google Home Graph API. The API is operated by a Service Account
, however, the Scope for the Google Home Graph [https://www.googleapis.com/auth/homegraph] is not valid.
This scope cannot be authenticated anywhere, especially in the Google's OAuth Playground, from which you are supposed to get the Agent User Id for the requests.
How to get the Agent User Id and execute Home Graph requests if the Home Graph Scope in invalid and cannot be authenticated?
Or, how to authenticate the Google Home Graph Scope which currently displays an error saying it is not valid?
The Credentials are retrieved from the Service Account's JSON file this way:
string[] Scopes = { HomeGraphServiceService.ScopeConstants.Homegraph };
ServiceAccountCredential ServiceCred
using (FileStream stream = new FileStream("MainCredentials.json", FileMode.Open, FileAccess.ReadWrite))
{
ServiceCred = ServiceAccountCredential.FromServiceAccountData(stream);
GoogleCredential credentials = GoogleCredential.FromServiceAccountCredential(ServiceCred).CreateScoped(Scopes);
var service = new HomeGraphServiceService(new BaseClientService.Initializer()
{
HttpClientInitializer = credentials,
ApplicationName = "Test Application",
});
}
The only thing I am able to do now is to load the Service Account Credential JSON File to a GoogleCredential
or ServiceAccountCredential
, but I cannot do anything without the AgentUserId
.