dkilgore90 / google-sdm-api

Apache License 2.0
70 stars 22 forks source link

Discover Button not showing #76

Closed automatestuff closed 2 years ago

automatestuff commented 2 years ago

I have went through the great implementation walk-thru and approved the two Nest Thermostat devices from the Google API approval process. When it redirects me back to the hubitat page I never see the "Discover Button" or any of the devices that I approved via the Google process.

automatestuff commented 2 years ago

I guess I should help with some supporting information. After I go through and authorize Hubitat to access the Thermostats I get a

Congratulations! Google SDM API has authenticated successfully

Click Here to return the App main page.

I do that and it redirected me back but still get the message

Device discovery button is hidden until authorization is completed.

dkilgore90 commented 2 years ago

Thanks for reporting! I do see a code gap where we essentially claim success when Google redirects back to Hubitat - but the actual login to get a token from Google might fail underneath. Can you check your Hubitat logs for the Google SDM API app? Expect we will see some errors at the time of authorization.

Meanwhile, I will fix the code so that the redirect page more accurately reflects the authorization state

automatestuff commented 2 years ago

app:2032022-02-02 10:35:26.251 errorcreateEventSubscription returned status code 401 -- { "error": { "code": 401, "message": "Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.", "status": "UNAUTHENTICATED" }} app:2032022-02-02 10:35:25.991 warnAuthorization token expired, will refresh and retry. app:2032022-02-02 10:35:25.957 errorcreateEventSubscription returned status code 401 -- { "error": { "code": 401, "message": "Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.", "status": "UNAUTHENTICATED" }} app:2032022-02-02 10:35:25.616 infoCreating Google pub/sub event subscription app:2032022-02-02 10:35:25.598 errorLogin failed -- status code: 400, reason phrase: Bad Request: [error:invalid_request, error_description:client_secret is missing.] app:2032022-02-02 10:35:25.300 infoGetting access_token from Google app:2032022-02-02 10:35:25.286 infosuccessful redirect from google app:2032022-02-02 10:35:00.945 infoGoogle SDM API updating

dkilgore90 commented 2 years ago

error_description:client_secret is missing

Looks like your login problem originates with the credentials.json data - maybe redownload this from the Google cloud console?

dkilgore90 commented 2 years ago

redirect page should now accurately reflect the login failure. LMK if you're still having trouble after double-checking the credentials.json, and/or feel free to engage in the community forum thread: https://community.hubitat.com/t/release-google-sdm-api-nest-integration/52226