Access your Google account and have access to your Drive. Set up a Google Drive environment for your users! Complete integrations with all of Google Drive APIs.
[center][h1][b]THE COMPLETE GOOGLE DRIVE INTEGRATION[/b][/h1][/center] [center][/center] Unlock the full potential of your Google Drive with our comprehensive Google Drive API Plugin for Bubble.io! This plugin enables seamless integration with all Google Drive APIs, allowing you and your users to effortlessly manage files and folders. [b]Key Features:[/b] [ml][ul][li indent=0 align=left][b]Create a File:[/b] Generate new files directly in your Google Drive.[/li][li indent=0 align=left][b]List Files:[/b] Retrieve a list of all files stored in your Drive.[/li][li indent=0 align=left][b]List Files from Specific Folder:[/b] Access files from designated folders with ease.[/li][li indent=0 align=left][b]Download Drive File:[/b] Download files from your Google Drive to your local system.[/li][li indent=0 align=left][b]Custom OAuth Login:[/b] Implement a secure and customizable OAuth login process.[/li][li indent=0 align=left][b]Get Access Token:[/b] Obtain an access token for API interactions.[/li][li indent=0 align=left][b]Refresh Access Token:[/b] Ensure continuous access by refreshing tokens as needed.[/li][li indent=0 align=left][b]Get Single File:[/b] Retrieve detailed information about a specific file.[/li][li indent=0 align=left][b]Copy File:[/b] Duplicate files within your Drive.[/li][li indent=0 align=left][b]Change File Name:[/b] Rename files to keep your Drive organized.[/li][li indent=0 align=left][b]Delete File:[/b] Remove unwanted files from your Drive.[/li][li indent=0 align=left][b]Create Folder:[/b] Organize your files by creating new folders.[/li][li indent=0 align=left][b]Move File to Folder:[/b] Easily move files between folders.[/li][li indent=0 align=left][b]Export Google Document:[/b] Export Google Docs to various formats.[/li][li indent=0 align=left][b]Create File Permissions:[/b] Manage and assign permissions for your files.[/li][li indent=0 align=left][b]Get User's Drive Information:[/b] Access detailed information about the user's Drive.[/li][/ul][/ml] [b]Important Requirements:[/b] To use this plugin, you will need a [i]Client ID[/i] and [i]Client Secret key[/i], which can be obtained from the Google Cloud Console. [b]Please note:[/b] This plugin does not work with the regular Bubble-OAuth implementation login. It is based on the access_token system and will keep users logged in indefinitely unless they revoke access. You will need to handle this on the backend (follow instructions). [b]For a live demo, please visit:[/b] [url=https://plugins.datamaticsoftware.com/google_drive]https://plugins.datamaticsoftware.com/google_drive[/url] [b]Enhance your Bubble.io application with the Google Drive API Plugin.[/b] Empower your users with full access to Google Drive, enabling efficient file management and seamless integration within your no-code platform.
This are step-by-step instructions on how to get the plugin working on any Bubble App.
[b]Note[/b]: User's database needs to have a access_token, refresh_token, and token_expire_date fields (can be named differently but keep them in mind when doing actions).
[ml][ol][li indent=0 align=left]Add this plugin to your application.[/li][li indent=0 align=left]Go to [url=https://console.cloud.google.com/]https://console.cloud.google.com/[/url] (create an account if you don't have one).[/li][li indent=0 align=left]Navigate to APIs & Services then click in the Credentials section in the left menu.[/li][li indent=0 align=left]Click create credential, Oauth Client ID[/li][ol data=1][li indent=1 align=left]Application Type: Web[/li][li indent=1 align=left]Authorized JavaScript origins: https://bubble.io[/li][li indent=1 align=left]Authorized redirect URIs: The Redirect URL your app has. Most likely will be the same where login action occurs.[/li][li indent=1 align=left]Save the new Client ID[/li][/ol][li indent=0 align=left]Copy Client ID & Client Secret.[/li][li indent=0 align=left]In the Bubble plugin page, place your Client ID & Client Secret (remember to check the checkbox of generic redirect URL).[/li][li indent=0 align=left]Add the 'Google Drive' Element into your Editor (you can set the redirect uri dynamically to 'This url').[/li][li indent=0 align=left]Use button to create a Google Sign In Button and on click add the action 'Oauth Log In' from the Google Drive element.[/li][li indent=0 align=left]Create a Workflow Event callled 'Google Drive has a valid response'.[/li][li indent=0 align=left]Create action 'Create account for someone else' using Google Drive's exposed states to fill up your User fields. (check the box 'Return the user if the account already exists').[/li][li indent=0 align=left] Add action 'Assing temp password to user' with the user from Step 1 in the Workflow.[/li][li indent=0 align=left] Add action 'Log the user in' with steps 1 and 2 from the Workflow.[/li][li indent=0 align=left]Finally add another Event 'When User is logged in' and set the condition when 'Current User's token_expire_date < Current date/time'. [/li][li indent=0 align=left]Add the action 'Refresh Access Token' and set the Current User's refresh_token value. [/li][li indent=0 align=left] Lastly add the action 'Make changes to current user' and update Current user's access_token and token_expire_date with the result from previous step.[/li][/ol][/ml] [ml][ul][li indent=0 align=left][b]Demo:[/b] [url=]][/li][li indent=0 align=left][b]Documentation:[/b] [url=]][/li][li indent=0 align=left][b]Editor:[/b] [url=]][/li][/ul][/ml]
[h3][b][u]Data Calls[/u][/b][/h3] [ml][ol][li indent=0 align=left]Google Drive - Get User Profile[/li][li indent=0 align=left]Google Drive - User's Drive Information[/li][li indent=0 align=left]Google Drive - List Files[/li][li indent=0 align=left]Google Drive - List Files from Folder[/li][li indent=0 align=left]Google Drive - Get File[/li][/ol][/ml] [h3][b][u]Elements[/u][/b][/h3] [ml][ol][li indent=0 align=left]Google Drive[/li][/ol][/ml][h3][b][u]Events[/u][/b][/h3] [ml][ol][li indent=0 align=left]A Google Drive has a valid response[/li][/ol][/ml] [h3][b][u]Actions[/u][/b][/h3] [ml][ol][li indent=0 align=left]Google Drive - Create File[/li][li indent=0 align=left]Google Drive - Copy File[/li][li indent=0 align=left]Google Drive - Delete File[/li][li indent=0 align=left]Google Drive - Change File Name[/li][li indent=0 align=left]Google Drive - Create Permission[/li][li indent=0 align=left]Google Drive - Create Folder[/li][li indent=0 align=left]Google Drive - Move to Folder[/li][li indent=0 align=left]Google Drive - Export Google Document[/li][li indent=0 align=left]Oauth Login In Google Drive[/li][li indent=0 align=left]Refresh Access Token[/li][li indent=0 align=left]Download Drive File[/li][/ol][/ml] [h3][b]Google Drive - Get User Profile[/b][/h3] Lists the user profile information.
[h3]Path parameters[/h3] [ml][ul][li indent=0 align=left][b]access:token:[/b] A valid access_token.[/li][/ul][/ml]
[h3][b]Google Drive - User's Drive Information[/b][/h3] Gets information about the user, the user's Drive, and system capabilities
[h3]Path parameters[/h3] [ml][ul][li indent=0 align=left][b]access:token:[/b] A valid access_token.[/li][/ul][/ml]
[h3]Response body[/h3] If successful, the response body contains an instance of [color=rgb(0, 102, 204)][url=https://developers.google.com/drive/api/v3/reference/about][u]About[/u][/url][/color]
[h3][b]Google Drive - List Files[/b][/h3] Lists or searches files. This method accepts the q parameter, which is a search query combining one or more search terms.
[h3]Path parameter[/h3] [ml][ul][li indent=0 align=left][b]access_token:[/b] A valid access_token.[/li][li indent=0 align=left][b]orderBy[/b]: A comma-separated list of sort keys. Valid keys are 'createdTime', 'folder', 'modifiedByMeTime', 'modifiedTime', 'name', 'name_natural', 'quotaBytesUsed', 'recency', 'sharedWithMeTime', 'starred', and 'viewedByMeTime'. Each key sorts ascending by default, but may be reversed with the 'desc' modifier. Example usage: ?orderBy=folder,modifiedTime desc,name.[/li][li indent=0 align=left][b]PageSize[/b]: The maximum number of files to return per page. Partial or empty result pages are possible even before the end of the files list has been reached. Acceptable values are 1 to 1000, inclusive[/li][li indent=0 align=left][b]q[/b]: A query for filtering the file results. See the "[color=rgb(0, 102, 204)][url=https://developers.google.com/drive/api/v3/search-files][u]Search for files[/u][/url][/color]" guide for the supported syntax.[/li][li indent=0 align=left][b]corpora[/b]: Groupings of files to which the query applies. Supported groupings are: 'user' (files created by, opened by, or shared directly with the user), 'drive' (files in the specified shared drive as indicated by the 'driveId'), 'domain' (files shared to the user's domain), and 'allDrives' (A combination of 'user' and 'drive' for all drives where the user is a member). When able, use 'user' or 'drive', instead of 'allDrives', for efficiency[/li][/ul][/ml] [h3]Response body[/h3] If successful, this method returns a response body with the following structure: [code]{ "kind": "drive#fileList", "nextPageToken": string, "incompleteSearch": boolean, "files": [ files Resource ] } [/code] [color=rgb(136, 136, 136)]For official documentation please visit: [/color][color=rgb(0, 102, 204)][url=https://developers.google.com/drive/api/v3/reference/files/list][u]List Files[/u][/url][/color]
[h3][b]Google Drive - List Files from Folder[/b][/h3] Lists or search files from a specific folder
[h3]Path parameters[/h3] [ml][ul][li indent=0 align=left][b]Folder ID[/b]: The ID of the folder. To list all files in the root folder, use the alias root as the value for Folder ID[/li][li indent=0 align=left][b]access_token[/b]: A valid access_token.[/li][/ul][/ml] [h3]Response body[/h3] If successful, the response body contains the following structure:
[quote]JSON representation[/quote][code]{ "kind": "drive#fileList", "nextPageToken": string, "incompleteSearch": boolean, "files": [ files Resource ] } [/code]
[h3][b]Google Drive - Get File[/b][/h3] Gets a file's metadata or content by ID.
Path parameters [ml][ul][li indent=0 align=left][b]File ID[/b]: The ID of the file.[/li][li indent=0 align=left][b]access_token[/b]: A valid access_token[/li][li indent=0 align=left][b]Fields[/b]: The paths of the fields you want included in the response. If not specified, the response includes a default set of fields specific to this method. For development you can use the special value * to return all fields, but you'll achieve greater performance by only selecting the fields you need[/li][/ul][/ml] [h3]Response body[/h3] If successful, the response body contains an instance of a [color=rgb(0, 102, 204)][url=https://developers.google.com/drive/api/v3/reference/files][u]Google Drive File[/u][/url][/color]
[h3][b]Google Drive[/b][/h3] Element that will catch and exchange the token. Set the redirect uri and use any other element to function as login click. Call the element's action 'Oauth Login' When triggered, Google Drive will redirect to Google Oauth and when returned, if successful, Google Drive element will expose its states which contain user name, email, picture, access_token, token expires in and refresh_token. Be sure to have the correct DB configuration to save this.
[h3][b]A Google Drive has a valid response[/b][/h3] Event that fires upon a successful return from Google Oauth login. In this event workflow you should create the user and handle tokens.
[h3][b]Google Drive - Create File[/b][/h3] Creates a new file.
[h3]Path parameters[/h3] [ml][ul][li indent=0 align=left][b]access_token:[/b] A valid access_token[/li][li indent=0 align=left][b]filename:[/b] Set the name of the file[/li][li indent=0 align=left][b]File Data:[/b] Base64 encoded data of the file.[/li][li indent=0 align=left][b]File description:[/b] OPTIONAL. Description of file to be included[/li][/ul][/ml] [h3]Response body[/h3] [color=rgb(32, 33, 36)]If successful, this method returns a [/color][color=rgb(0, 102, 204)][url=https://developers.google.com/drive/api/v3/reference/files#resource]Files resource[/url][/color][color=rgb(32, 33, 36)] in the response body.[/color]
[h3][b]Google Drive - Create File[/b][/h3] Creates a new file.
[h3]Path parameters[/h3] [ml][ul][li indent=0 align=left][b]access_token:[/b] A valid access_token[/li][li indent=0 align=left][b]filename:[/b] Set the name of the file[/li][li indent=0 align=left][b]File Data:[/b] Base64 encoded data of the file.[/li][li indent=0 align=left][b]File description:[/b] OPTIONAL. Description of file to be included[/li][/ul][/ml] [h3]Response body[/h3] [color=rgb(32, 33, 36)]If successful, this method returns a [/color][url=https://developers.google.com/drive/api/v3/reference/files#resource]Files resource[/url][color=rgb(32, 33, 36)] in the response body.[/color]
[h3][b]Google Drive - Copy File[/b][/h3] Copies a file and create a new one.
[h3]Path parameters[/h3] [ml][ul][li indent=0 align=left][b]access_token:[/b] A valid access_token[/li][li indent=0 align=left][b]File ID:[/b] ID of the file[/li][/ul][/ml] [h3]Response body[/h3] [color=rgb(32, 33, 36)]If successful, this method returns a [/color][url=https://developers.google.com/drive/api/v3/reference/files#resource]Files resource[/url][color=rgb(32, 33, 36)] in the response body.[/color]
[h3][b]Google Drive - Delete File[/b][/h3] Deletes a file.
[h3]Path parameters[/h3] [ml][ul][li indent=0 align=left][b]access_token:[/b] A valid access_token[/li][li indent=0 align=left][b]File ID:[/b] ID of the file.[/li][/ul][/ml] [h3]Response body[/h3] [color=rgb(32, 33, 36)]If successful, this method returns an empty response body.[/color]
[h3][b]Google Drive - Change File Name[/b][/h3] Update a file's metadata.
[h3]Path parameters[/h3] [ml][ul][li indent=0 align=left][b]access_token:[/b] A valid access_token[/li][li indent=0 align=left][b]File ID:[/b] ID of the file.[/li][li indent=0 align=left][b]filename[/b]: New filename[/li][/ul][/ml] [h3]Response body[/h3] [color=rgb(32, 33, 36)]If successful, this method returns a [/color][color=rgb(0, 102, 204)][url=https://developers.google.com/drive/api/v3/reference/files#resource]Files resource[/url][/color][color=rgb(32, 33, 36)] in the response body.[/color]
[h3][b]Google Drive - Create Permission[/b][/h3] Creates a permission for a file or shared drive
[h3]Path parameters[/h3] [ml][ul][li indent=0 align=left][b]access_token:[/b] A valid access_token[/li][li indent=0 align=left][b]File ID:[/b] ID of the file.[/li][li indent=0 align=left][b]Role[/b]: The role field identifies the operations that the type can perform. Accepted values are: reader, commenter, writer, fileOrganizer.[/li][li indent=0 align=left][b]Type[/b]: The type identifies the scope of the permission (user, group, or anyone).[/li][li indent=0 align=left][b]email[/b]: Email of the user or group that will be granted permissions[/li][li indent=0 align=left][b]Message[/b]: A plain text custom message to include in the notification email.[/li][/ul][/ml] [h3]Response body[/h3] If successful, this method returns a [color=rgb(0, 102, 204)][url=https://developers.google.com/drive/api/v3/reference/permissions#resource]Permissions resource[/url][/color] in the response body.
[h3][b]Google Drive - Create Folder[/b][/h3] Creates a new folder
[h3]Path parameters[/h3] [ml][ul][li indent=0 align=left][b]access_token:[/b] A valid access_token[/li][li indent=0 align=left][b]Folder name:[/b] Name of the new folder.[/li][/ul][/ml] [h3]Response body[/h3] [color=rgb(32, 33, 36)]If successful, this method returns a [/color][color=rgb(0, 102, 204)][url=https://developers.google.com/drive/api/v3/reference/files#resource]Files resource[/url][/color][color=rgb(0, 102, 204)] [/color][color=rgb(32, 33, 36)]in the response body.[/color]
[h3][b]Google Drive - Move to a Folder[/b][/h3] Creates a new folder
[h3]Path parameters[/h3] [ml][ul][li indent=0 align=left][b]access_token:[/b] A valid access_token[/li][li indent=0 align=left][b]File ID:[/b] ID of the file to be moved.[/li][li indent=0 align=left][b]Folder ID[/b]: ID of the new folder parent.[/li][/ul][/ml] [h3]Response body[/h3] [color=rgb(32, 33, 36)]If successful, this method returns a [/color][color=rgb(0, 102, 204)][url=https://developers.google.com/drive/api/v3/reference/files#resource]Files resource[/url][/color][color=rgb(32, 33, 36)] in the response body.[/color]
[h3][b]Google Drive - Export Google Document[/b][/h3] [color=rgb(32, 33, 36)]Exports a Google Workspace document to the requested MIME type and returns exported byte content. Note that the exported content is limited to 10MB[/color]
[h3]Path parameters[/h3] [ml][ul][li indent=0 align=left][b]access_token:[/b] A valid access_token[/li][li indent=0 align=left][b]File ID:[/b] ID of the file to be moved.[/li][li indent=0 align=left][b]Mime Type[/b]: [color=rgb(32, 33, 36)][highlight=rgba(255, 255, 255, 0.95)]The MIME type of the format requested for this export[/highlight][/color][/li][/ul][/ml] [h3]Response body[/h3] [color=rgb(32, 33, 36)]If successful, this method returns the file content as bytes. For a list of Google Workspace documents and MIME type conversion formats, see[/color][color=rgb(0, 102, 204)] [/color][color=rgb(0, 102, 204)][url=https://developers.google.com/drive/api/v3/ref-export-formats]Google Workspace documents and corresponding export MIME types[/url][/color][color=rgb(0, 102, 204)].[/color]
[h3][b]Refresh Access Token[/b][/h3] Replace user's access_token with a valid new one. Access tokens periodically expire and become invalid credentials for a related API request. You can refresh an access token without prompting the user for permission
[h3]Path parameters[/h3] [ml][ul][li indent=0 align=left][b]refresh_token:[/b] The refresh_token returned from Gmail element will serve for the purpose of refreshing tokens.[/li][/ul][/ml] [h3]Response body[/h3] [ml][ul][li indent=0 align=left][b]access_token:[/b] The new access_token. Be sure to update the user's row in the DB.[/li][li indent=0 align=left][b]expires_in[/b]: Time in seconds of when access_token will expire.[/li][/ul][/ml]