sample-googleassistant icon indicating copy to clipboard operation
sample-googleassistant copied to clipboard

I don't know how to use this google-oauthlib-tool tool to get credentials.json

Open 2014james opened this issue 5 years ago • 7 comments

I installed the python environment and installed the google-oauthlib-tool package via the pip command. I don't know the python language. I don't know how to use this google-oauthlib-tool tool to get credentials.json. Can anyone tell me the specifics? How to use, my project is android, thank you very much

2014james avatar Jan 03 '19 00:01 2014james

The instructions are listed in the README. You need to generate the credentials.json based on the client_secret_xxx.json file you download from the Actions console.

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

Fleker avatar Jan 07 '19 19:01 Fleker

Hello, the credentials have been solved, I want to achieve the function is: develop an app like Google assistant assistant assistant to run on the smartphone, can this demo run directly on the smartphone, I do not know what this Google assistant has to do with Android things, I see the code about hardware LED lights, I do not understand what it means, Ma. Thank you for your help.

2014james avatar Jan 08 '19 01:01 2014james

Hello, why does the JSON I got have no credential field?

2014james avatar Jan 08 '19 02:01 2014james

You should read about Android Things and the platform differences between it and a standard mobile app.

After generating credentials.json, you will get a file that contains a refresh token, among other fields, which will enable the application to authenticate to your account.

Fleker avatar Jan 08 '19 03:01 Fleker

@Fleker Hello, can you explain the specific problem? I don't know much about things, and it took me a long time to study the credentials. At present, it's rather urgent. I want to make demo run quickly to determine if it's the effect I want. Thank you.

2014james avatar Jan 08 '19 03:01 2014james

The Google Assistant API does not work anonymously. It needs to be authenticated with a user's account, which will provide personal answers to that user.

You first need to download a client secret from the Actions console. The client secret JSON essentially contains a project username and password, which allows the google-oauthlib-tool to authenticate to the project-level.

After that, you need to give the project permission to use your user account. Once that happens, it will generate a credentials.json, which will allow the app to authenticate as you and programtically call the Google Assistant.

Fleker avatar Jan 08 '19 20:01 Fleker

I have been trying to get this to work for hours. I have the client_secrets_xxx.json but when I navigate to the "authorize this application url" I get I'm trying to register a hardware device and don't want to configure an oAuth2 server, that seems RIDICULOUS!


Error: restricted_client

A native application: Coffee Maker

You can email the developer of this application at: [email protected]

This app is not yet configured to make OAuth requests. To do that, set up the app’s OAuth consent screen in the Google Cloud Console.

Learn more

Request Details
response_type=code
client_id=xxxx
redirect_uri=urn:ietf:wg:oauth:2.0:oob
scope=https://www.googleapis.com/auth/assistant-sdk-prototype
state=lgMkmlmtvGQZhkWS1jeMg77HEyANEJ
prompt=consent
access_type=offline
That’s all we know.```


AcidRobot avatar Nov 22 '19 21:11 AcidRobot