Google Auth
Last updated
Last updated
Learn how to create an OAuth app in Google Cloud, obtain the necessary credentials and access tokens, and add them to BroxiAI's Google components.
Navigate to the .
Click Select a project, and then click New Project to create a new project.
To enable APIs for the project, select APIs & Services, and then click Library. Enable the APIs you need for your project. For example, if your flow uses the Google Drive component, enable the Google Drive API.
To navigate to the OAuth consent screen, click APIs & Services, and then click OAuth consent screen.
Populate your OAuth consent screen with the application name, audience, and user support email. For audience, select External. This creates a testing application environment that you can add users to.
To create an OAuth Client ID, navigate to Clients, and then click Create Client.
Choose Desktop app as the application type, and then name your client ID.
Click Create. A Client ID and Client Secret are created. Download the credentials as a JSON file to your local machine and save it securely.
With your OAuth application configured and your credentials JSON file created, follow these steps to authenticate the BroxiAI application.
Create a new project in Langflow.
Add a Google OAuth Token component to your flow.
In the Credentials File field of the Google OAuth Token component, enter the path to your Credentials File, the JSON file containing the Client ID credentials you downloaded from Google in the previous steps.
To authenticate your application, in the Google OAuth Token component, click Play. A new tab opens in the browser to authenticate your application using your Google Cloud account. You must authenticate the application with the same Google account that created the OAuth credentials.
After successful authentication, your BroxiAI application can request and refresh tokens. These tokens enable BroxiAI to interact with Google services on your behalf and execute your specified requests.
In this example, the Google Drive loader component loads a text file hosted on Google Drive, translates the text to Spanish, and returns it to a chat output.
To import the downloaded JSON to Langflow, click Options, and then select Import.
In the Credentials File field of the Google OAuth Token component, enter the path to your Credentials File, the JSON file containing the Client ID credentials you downloaded from Google in the previous steps.
To allow the Langflow component to access the document in Google Drive, copy the Google Drive documentID
from the document's URL.
In the Google Drive loader component, in the Document ID field, paste the document URL.
To view the translated document, open the Playground.
To add users to your OAuth audience, click Audience. Under Test users, click Add users. Enter any email addresses you intend to use to authenticate Langflow with OAuth. These email addresses have access to the application while it's in a Testing publishing state. For more information, see the .
In the Scopes field of the Google Oauth Token component, enter the scope required to access your resources. For example, to allow your Langflow application to access a user's Google Drive, the scope is https://www.googleapis.com/auth/drive
. For more information, see the .
For a pre-built JSON file of a flow that uses the Google Drive loader component, download the to your local machine.
Download the to your local machine.
In the Scopes field of the Google Oauth Token component, enter the scope required to access your resources. For example, to allow your Langflow application to access a user's Google Drive, the scope is https://www.googleapis.com/auth/drive
. For more information, see the . The example flow includes a Parse data component to convert the data
output of the Google OAuth Token component to the text
input of the JSON Cleaner component.