GuillaumeWaignier / fibaro

Some fibaro quickApp
Apache License 2.0
13 stars 4 forks source link

help #4

Closed barbaric-t closed 1 year ago

barbaric-t commented 2 years ago

Hello,

can you support with this app?

In Fibaro I'm retrieving:

[03.02.2022] [11:38:16] [DEBUG] [QUICKAPP919]: Get Google refresh token [03.02.2022] [11:38:16] [ERROR] [QUICKAPP919]: getRefreshToken() status is 400: { "error [03.02.2022] [11:39:16] [ERROR] [QUICKAPP919]: Need to refresh Nest Authentication code for quickApp 919 with https://nestservices.google.com/partnerconnections/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/auth?redirect_uri=https://www.google.com&access_type=offline&prompt=consent&client_id=xxx-xxx.apps.googleusercontent.com&response_type=code&scope=https://www.googleapis.com/auth/sdm.service

GuillaumeWaignier commented 2 years ago

Hello,

Have you follow the installation guide and set the Variables (projectId, clientId, clientSecret) in the Fibaro Home Center

https://github.com/GuillaumeWaignier/fibaro/blob/master/quickApp/Nest/README.md

Then this URL in the log will be used to get the Authentication code.

barbaric-t commented 2 years ago

Thank you! We tried from beginning, step by step. qapp received token but has an error with the new device creation:

[09.02.2022] [09:36:40] [TRACE] [QUICKAPP487]: Child devices: [09.02.2022] [09:36:40] [ERROR] [QUICKAPP487]: getAccessToken() status is 400: { "error [09.02.2022] [09:37:40] [DEBUG] [QUICKAPP487]: Get Google refresh token [09.02.2022] [09:37:40] [DEBUG] [QUICKAPP487]: getRefreshToken() succeed [09.02.2022] [09:37:40] [TRACE] [QUICKAPP487]: Bearer ya29.A0ARrdaxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx [09.02.2022] [09:38:41] [ERROR] [QUICKAPP487]: listNestDevice() status is 403: { "error

[09.02.2022] [09:38:54] [TRACE] [QUICKAPP487]: Child devices: [09.02.2022] [09:39:54] [ERROR] [QUICKAPP487]: listNestDevice() status is 403: { "error [09.02.2022] [09:40:54] [ERROR] [QUICKAPP487]: listNestDevice() status is 403: { "error [09.02.2022] [09:41:54] [ERROR] [QUICKAPP487]: listNestDevice() status is 403: { "error

[09.02.2022] [09:42:35] [TRACE] [QUICKAPP487]: Child devices:

GuillaumeWaignier commented 2 years ago

It seems there is a problem with Authorization (the code is 403 --> it correspond to a forbidden access).

With the URL of the form https://nestservices.google.com/partnerconnections/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/auth?redirect_uri=https://www.google.com&access_type=offline&prompt=consent&client_id=xxx-xxx.apps.googleusercontent.com&response_type=code&scope=https://www.googleapis.com/auth/sdm.service

which rights have you selected ?

barbaric-t commented 2 years ago

Attached screen which we see on generated URL

MicrosoftTeams-image (8)

barbaric-t commented 2 years ago

MicrosoftTeams-image (9)

barbaric-t commented 2 years ago

MicrosoftTeams-image (10)

GuillaumeWaignier commented 2 years ago

Have you several Google accounts ?

You need to use the same google Account for all processes (https://developers.google.com/nest/device-access/authorize#link_your_account)

If you call the API in a sheel command line (cmd tool), what is the result ?

curl -X GET -H "Content-Type: application/json"  -H "Authorization: Bearer access-token"  https://smartdevicemanagement.googleapis.com/v1/enterprises/project-id/devices 

You need to replace the project-id and the access-token with your custom values. The access-token is logged inside Fibaro log. https://developers.google.com/nest/device-access/authorize#make_a_device_list_call

Depending on the error, you have some tips to solve them: https://developers.google.com/nest/device-access/authorize#troubleshooting