-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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: Add Google Oauth Token Component #4383
feat: Add Google Oauth Token Component #4383
Conversation
viniciossilva3
commented
Nov 4, 2024
- Added the Google JSON Token component, which generates tokens for using Google APIs via OAuth.
- The component was mentioned in the Documentation but does not yet exist in the main repository: docs: add google integration #4382
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @viniciossilva3
This is nice. What are some use cases we can add to this?
Also, have you seen the LinkInput? Could be useful if you want to show a link dynamically
src/backend/base/langflow/components/data/google_oauth_token.py
Outdated
Show resolved
Hide resolved
Hi @ogabrielluiz, 1 - To use certain Google applications that require OAuth permissions (Drive, Sheets, Docs, Gmail and others...), you'll need a JSON string containing user data and an authentication token. For the existing components in Langflow (Google Drive Search, Google Drive Loader, and Gmail Loader), I found that the only way to access them was via the token generated by this component. 2 - Thanks, I didn't know, I'll check the use of LinkInput to add to the component. |
CodSpeed Performance ReportMerging #4383 will degrade performances by 22.54%Comparing Summary
Benchmarks breakdown
|
ebf9218
to
dfe6812
Compare
Hey @viniciossilva3 There are many lint and formatting errors that you still need to fix for us to approve this PR. |
I'll fix it now, I saw that autofix removed the import. |
Try running |
Thanks for the tip, thanks to that I was able to solve the problems. Can you check if everything is correct? |
flow = InstalledAppFlow.from_client_secrets_file(client_secret_file, scopes) | ||
creds = flow.run_local_server(port=0) | ||
|
||
with token_path.open(mode="w", encoding="utf-8") as token_file: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: use Path.write_text()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @cbornet , thank you!
I think it got better with your tip.
- Added documentation teaching how to configure an application using Google's OAuth API to use the components present in Langflow. Example: (Google Drive Loader, Google Drive Search and Gmail Loader). Co-authored-by: Vinícios Batista da Silva <[email protected]>
- Added the Google JSON Token component, which generates tokens for using Google APIs via OAuth. - The component was mentioned in the Documentation but does not yet exist in the main repository: langflow-ai#4382 Co-authored-by: Vinícios Batista da Silva <[email protected]>
Thanks, I've already made the correction. I'll be more careful. Co-authored-by: Gabriel Luiz Freitas Almeida <[email protected]>
- Removed unnecessary comments. - Refactored the return of the component's build function to make the code easier to read and to facilitate the correct return of output data. - Removed a space in the string of the component's display name - StrInput has been replaced by MultilineInput to provide more workspace for the user to add scope URLs. Co-authored-by: Vinícios Batista da Silva <[email protected]>
- Fixed Lint issue in file, json import added. - Removed values with populated scope urls. Co-authored-by: Vinícios Batista da Silva <[email protected]>
- Lint issues fixed - Refactored the use of paths in the component to avoid lint issues in "token.json" Co-authored-by: Vinícios Batista da Silva <[email protected]>
- Simplifies file handling by removing manual open/close steps Co-authored-by: Vinícios Batista da Silva <[email protected]>
Co-authored-by: Vinícios Batista da Silva <[email protected]>
133657f
to
8594413
Compare