mirror of
https://github.com/encounter/adk-python.git
synced 2026-07-09 18:19:28 -07:00
Merge https://github.com/google/adk-python/pull/4175 ### Link to Issue or Description of Change **1. Link to an existing issue (if applicable):** N/A: just fixing typos discovered while reading the repo **2. Or, if no issue exists, describe the change:** No code change, just typo fixes: see commit diffs for all details **Problem:** Trying to improve overall repo quality **Solution:** Fixing typos as they get discovered ### Testing Plan N/A **Unit Tests:** N/A **Manual End-to-End (E2E) Tests:** N/A ### Checklist - [X] I have read the [CONTRIBUTING.md](https://github.com/google/adk-python/blob/main/CONTRIBUTING.md) document. - [X] I have performed a self-review of my own code. - [ ] I have commented my code, particularly in hard-to-understand areas. - [ ] I have added tests that prove my fix is effective or that my feature works. - [X] New and existing unit tests pass locally with my changes. - [ ] I have manually tested my changes end-to-end. - [ ] Any dependent changes have been merged and published in downstream modules. COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/4175 from didier-durand:fix-typos-c 16e93ed2d9bc153fa0332ab1ae39633fcc5056e9 PiperOrigin-RevId: 858751240
49 lines
1.7 KiB
Markdown
49 lines
1.7 KiB
Markdown
# OAuth Sample
|
|
|
|
## Introduction
|
|
|
|
This sample tests and demos the OAuth support in ADK via two tools:
|
|
|
|
* 1. list_calendar_events
|
|
|
|
This is a customized tool that calls Google Calendar API to list calendar
|
|
events. It passes in the client id and client secret to ADK and then get back
|
|
the access token from ADK. And then it uses the access token to call
|
|
calendar api.
|
|
|
|
* 2. get_calendar_events
|
|
|
|
This is a google calendar tool that calls Google Calendar API to get the
|
|
details of a specific calendar. This tool is from the ADK built-in Google
|
|
Calendar ToolSet. Everything is wrapped and the tool user just needs to pass
|
|
in the client id and client secret.
|
|
|
|
## How to use
|
|
|
|
* 1. Follow
|
|
https://developers.google.com/identity/protocols/oauth2#1.-obtain-oauth-2.0-credentials-from-the-dynamic_data.setvar.console_name.
|
|
to get your client id and client secret. Be sure to choose "web" as your
|
|
client type.
|
|
|
|
* 2. Configure your `.env` file to add two variables:
|
|
|
|
* OAUTH_CLIENT_ID={your client id}
|
|
* OAUTH_CLIENT_SECRET={your client secret}
|
|
|
|
Note: don't create a separate `.env` file , instead put it to the same
|
|
`.env` file that stores your Vertex AI or Dev ML credentials
|
|
|
|
* 3. Follow
|
|
https://developers.google.com/identity/protocols/oauth2/web-server#creatingcred
|
|
to add http://localhost/dev-ui/ to "Authorized redirect URIs".
|
|
|
|
Note: localhost here is just a hostname that you use to access the dev ui,
|
|
replace it with the actual hostname you use to access the dev ui.
|
|
|
|
* 4. For 1st run, allow popup for localhost in Chrome.
|
|
|
|
## Sample prompt
|
|
|
|
* `List all my today's meeting from 7am to 7pm.`
|
|
* `Get the details of the first event.`
|