When I test to report smart home devices state to google, I get the following error:
"error": {
"code": 403,
"message": "The request is missing a valid API key.",
"status": "PERMISSION_DENIED"}
I follow this guide https://developers.google.com/assistant/smarthome/develop/report-state#service-account-key to get Service Account Key。
HttpEntity entity = httpRequest("https://www.googleapis.com/auth/homegraph", jwt, params, "application/x-www-form-urlencoded");
This is my code to get token.
HttpEntity entity = httpRequest("https://homegraph.googleapis.com/v1/devices:reportStateAndNotification", token, params, "application/json");
This is my code to report status.
I want to know if the token is invalid or what is wrong.
In addition, Does this have to do with agentUserId.
{"requestId": "123ABC","agentUserId": "user-123","payload": {
"devices": {
"states": {
"light-123": {
"on": true
}
}
}
} }