androidthings / sample-googleassistant

Google Assistant API sample for Android Things
Apache License 2.0
467 stars 147 forks source link

windows10 system can't create credentials.json #27

Closed qq601654720 closed 6 years ago

qq601654720 commented 7 years ago

I tried to create credentials.json from my windows10 system. And I already rename the file to client_secret_NNNN.json and copy to the project root directory But i am getting the following error. Step i followed:

google-oauthlib-tool --client-secrets client_secret_NNNN.json --credentials app/src/main/res/raw/credentials.json --scope https://www.googleapis.com/auth/assistant-sdk-prototype --save

Error Occured :

Please visit this URL to authorize this application: https://accounts.google.com/o/oauth2/auth?response_type=code&client_id=1052286463727-729o0p80qtcekjkcvsc86m5u3vbggbdo.apps.googleusercontent.com&redirect_uri=http%3A%2F%2Flocalhost%3A8080%2F&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fassistant-sdk-prototype&state=BgxGivn1AW3gKttg1rOJLNpngvz8i9&access_type=offline Traceback (most recent call last): File "c:\users\yaohj\appdata\local\programs\python\python36\lib\runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "c:\users\yaohj\appdata\local\programs\python\python36\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "C:\Users\yaohj\AppData\Local\Programs\Python\Python36\Scripts\google-oauthlib-tool.exe__main.py", line 9, in File "c:\users\yaohj\appdata\local\programs\python\python36\lib\site-packages\click\core.py", line 722, in call return self.main(args, kwargs) File "c:\users\yaohj\appdata\local\programs\python\python36\lib\site-packages\click\core.py", line 697, in main rv = self.invoke(ctx) File "c:\users\yaohj\appdata\local\programs\python\python36\lib\site-packages\click\core.py", line 895, in invoke return ctx.invoke(self.callback, ctx.params) File "c:\users\yaohj\appdata\local\programs\python\python36\lib\site-packages\click\core.py", line 535, in invoke return callback(args, **kwargs) File "c:\users\yaohj\appdata\local\programs\python\python36\lib\site-packages\google_auth_oauthlib\tool\main__.py", line 104, in main creds = flow.run_local_server() File "c:\users\yaohj\appdata\local\programs\python\python36\lib\site-packages\google_auth_oauthlib\flow.py", line 414, in run_local_server self.fetch_token(authorization_response=authorization_response) File "c:\users\yaohj\appdata\local\programs\python\python36\lib\site-packages\google_auth_oauthlib\flow.py", line 234, in fetch_token client_secret=self.client_config['client_secret'], KeyError: 'client_secret'

Kindly help me to resolve this issue.

Ranjith1992 commented 7 years ago

While creating client_secret_NNNN.json file , choose "other" instead of "android".

proppy commented 7 years ago

as @Ranjith1992 commented it should work if you use the credentials Other as pointed in the documented linked from the README: https://developers.google.com/assistant/sdk/develop/grpc/config-dev-project-and-account

We should probably reinforce it in the README.md as it is not the first time this was mentioned.