Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(platform): Add Gmail and Google Sheets blocks + fix Google OAuth #8236

Merged
merged 53 commits into from
Oct 3, 2024

Conversation

ntindle
Copy link
Member

@ntindle ntindle commented Oct 1, 2024

Background

We have several agents that we want to integrate with google services

Changes 🏗️

This pr does a handful of things

OAuth

  • Adds oauth scopes to the oauth base
  • adds default scopes to the oauth base
  • adds upgrading scopes to google
  • adds helpers for scopes

Blocks

  • Adds gmail read/write blocks
  • Adds google sheets read/write block
  • Adds a few more categories for these blocks (up for discussion)

Testing 🔍

Warning

This PR has auth changes. Review it top to bottom. Test plan included in comments, with issues that I've seen highlighted

Note

Only for the new autogpt platform, currently in autogpt_platform/

  • Create from scratch and execute an agent with at least 3 blocks
  • Import an agent from file upload, and confirm it executes correctly
  • Upload agent to marketplace
  • Import an agent from marketplace and confirm it executes correctly
  • Edit an agent from monitor, and confirm it executes correctly

@github-actions github-actions bot added platform/frontend AutoGPT Platform - Front end platform/backend AutoGPT Platform - Back end platform/blocks size/xl labels Oct 1, 2024
Copy link

netlify bot commented Oct 1, 2024

Deploy Preview for auto-gpt-docs canceled.

Name Link
🔨 Latest commit 08ffc25
🔍 Latest deploy log https://app.netlify.com/sites/auto-gpt-docs/deploys/66fec64fc08c5e00084d716b

@ntindle ntindle changed the title feat(frontend,backend): fix google auth and gmail feat(frontend,backend): fix google auth and add gmail Oct 1, 2024
@ntindle
Copy link
Member Author

ntindle commented Oct 1, 2024

guess is most of the frontend stuff isn't needed

@ntindle
Copy link
Member Author

ntindle commented Oct 1, 2024

Test Plan

test logging in/out and making sure your tokens for github and google still work

Test gihtub agents

test showing status and output of blocks during execution

test /monitoring post requests -> sometimes failed for me due to being 'too big'. Is this known

Test sheets reading/writing -> can you do the same sheet with a list input etc

Test reading/sending emails -> don't get us rate limited or blocked with spam while testing this. Seriously. Only email internal accounts, or yourself.

@ntindle ntindle marked this pull request as ready for review October 1, 2024 03:27
@ntindle ntindle requested a review from a team as a code owner October 1, 2024 03:27
@ntindle ntindle requested review from aarushik93 and majdyz and removed request for a team October 1, 2024 03:27
@ntindle ntindle changed the title feat(frontend,backend): fix google auth and add gmail feat(frontend,backend): fix google auth and add gmail, sheets Oct 1, 2024
Copy link

qodo-merge-pro bot commented Oct 1, 2024

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 4 🔵🔵🔵🔵⚪
🧪 No relevant tests
🔒 Security concerns

Sensitive information exposure:
The OAuth flow involves handling sensitive information such as access tokens and refresh tokens. While the code appears to use SecretStr for storing these tokens, extra care should be taken to ensure they are not logged or exposed in any way, especially in error messages or debug logs.

⚡ Recommended focus areas for review

Error Handling
The exchange_code_for_tokens method has complex error handling that might benefit from refactoring for better readability and maintainability.

Error Logging
The callback function has multiple try-except blocks that might be consolidated for better error handling and logging.

Complex Function
The handleOAuthLogin function is quite long and complex. Consider breaking it down into smaller, more manageable functions.

@ntindle ntindle requested a review from Pwuts October 2, 2024 22:09
@ntindle ntindle requested a review from Pwuts October 3, 2024 10:11
@ntindle ntindle merged commit 6dbc0f7 into master Oct 3, 2024
16 checks passed
@ntindle ntindle deleted the add-gmail branch October 3, 2024 16:36
token=token,
provider=provider,
expires_at=int(expires_at.timestamp()),
scopes=scopes,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure how this passed CI when OAuthState has no scopes field

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

apparently we're not running CI on autogpt_libs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants