0

I can sync and send commands to my devices with my GH action. But after 1 hour, I always get "I'm sorry, there was an error and I'm unable to control your home device." Nothing is sent to my cloud function action. When I unlink the service and link it again all works as expected. How can I troubleshoot this problem?

Btw I used Google Sign-In for OAuth and account linkling.

user430926
  • 4,017
  • 13
  • 53
  • 77
  • Seems like there's an issue in your OAuth implementation where you aren't sending new auth tokens after the current ones expire. Auth tokens generally expire after one hour. – Nick Felker Nov 08 '17 at 05:17
  • In Client Information section, I already entered the Client ID and Client Secret from the credentials in the Cloud Console. For Authorization URL, https://accounts.google.com/o/oauth2/v2/auth. For Token URL, https://www.googleapis.com/oauth2/v4/token. Scopes,https://www.googleapis.com/auth/userinfo.profile, https://www.googleapis.com/auth/userinfo.email, https://www.googleapis.com/auth/cloud-platform. Am I missing something here @Nick Felker? Thanks – user430926 Nov 08 '17 at 06:04
  • I don't believe it's a console issue. The tokens expire after some time and you don't have any logic to reject an expired token. By sending an expired code error back, the Assistant servers should request a new token. https://github.com/actions-on-google/actionssdk-smart-home-nodejs/blob/master/smart-home-provider/cloud/auth-provider.js#L317 – Nick Felker Nov 08 '17 at 18:43
  • @Nick Felker its means I need to implement my own OAuth server? Since using googleapis.com/oauth2/v4/token can't handle it, right? – user430926 Nov 10 '17 at 01:31
  • 1
    Yes you should have your own implementation of OAuth, especially if you plan on submitting it. It is against the existing policy to use Google's URLs for your OAuth. – Nick Felker Nov 10 '17 at 02:04

1 Answers1

2

You can't use accounts.google.com/o/oauth2/v2/auth & googleapis.com/oauth2/v4/token anymore. They might work in the test version of your app but your app will not be published unless you implement your own OAuth server. This means setting up your own Auth and Token endpoints (or just Auth if you use the implicit flow) where the user can log in and authenticate with your service.

Bart
  • 498
  • 2
  • 8