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

community: add scope validation for Google Drive API credentials #667

Merged
merged 1 commit into from
Jan 6, 2025

Conversation

madhukar32
Copy link
Contributor

@madhukar32 madhukar32 commented Jan 3, 2025

PR Description

This PR makes the Google Drive API scopes configurable in the GoogleDriveLoader class instead of using a hardcoded global constant. This change allows users to specify different scopes based on their needs while maintaining backward compatibility with the default drive.file scope.

Currently, the scope is hardcoded to drive.file which is restrictive and only allows access to files created by the app. This change enables users to use different scopes like drive.readonly for broader read access without modifying the source code.

Relevant issues

ref: #666

Type

🐛 Bug Fix

Changes(optional)

  • Added configurable scopes parameter to GoogleDriveLoader class
  • Implemented scope validation with predefined valid scopes
  • Maintained backward compatibility by using original scope as default
  • Added documentation for available scopes
  • Added unittest to verify the scopes

@madhukar32
Copy link
Contributor Author

Hi @lkuligin,

Could you pls review the PR when you get a chance? Thanks

@lkuligin
Copy link
Collaborator

lkuligin commented Jan 4, 2025

@madhukar32 Thanks for your contribution! Please, take a look at remaining linter errors, and I'm happy to merge when it's fixed.

…ials

Add validation for Google Drive API scopes to ensure only valid scopes are provided.
This improves error handling by validating scopes before attempting to use them
with the API, providing clearer error messages when invalid scopes are specified.

ref: langchain-ai#666
@madhukar32
Copy link
Contributor Author

@madhukar32 Thanks for your contribution! Please, take a look at remaining linter errors, and I'm happy to merge when it's fixed.

Thanks @lkuligin for your response, I fixed the lint errors and pushed it again.

@lkuligin lkuligin merged commit 3455e76 into langchain-ai:main Jan 6, 2025
15 checks passed
@madhukar32 madhukar32 deleted the drive-creds-scope branch January 6, 2025 17:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants