Google Drive node common issues#
Here are some common errors and issues with the Google Drive node and steps to resolve or troubleshoot them.
Google hasn't verified this app#
If using the OAuth authentication method, you might see the warning Google hasn't verified this app. To avoid this, you can create OAuth credentials from the same account you want to authenticate.
If you need to use credentials generated by another account (by a developer or another third party), follow the instructions in Google Cloud documentation | Authorization errors: Google hasn't verified this app.
Google Cloud app becoming unauthorized#
For Google Cloud apps with Publishing status set to Testing and User type set to External, consent and tokens expire after seven days. Refer to Google Cloud Platform Console Help | Setting up your OAuth consent screen for more information. To resolve this, reconnect the app in the n8n credentials modal.
Google Drive OAuth error#
If using the OAuth authentication method, you may see an error indicating that you can't sign in because the app doesn't meet Google's expectations for keeping apps secure.
Most often, the actual cause of this issue is that the URLs don't match between Google's OAuth configuration and n8n. To avoid this, start by reviewing any links included in Google's error message. This will contain details about the exact error that occurred.
If you are self-hostin n8n, check the n8n configuration items used to construct external URLs. Verify that the N8N_EDITOR_BASE_URL
and WEBHOOK_URL
environment variables use fully qualified domains.
Get recent files from Google Drive#
To retrieve recent files from Google Drive, you need to sort files by modification time. To do this, you need to search for existing files and retrieve their modification times. Next you can sort the files to find the most recent file and use another Google Drive node target the file by ID.
The process looks like this:
- Add a Google Drive node to your canvas.
- Select the File/Folder resource and the Search operation.
- Enable Return All to sort through all files.
- Set the What to Search filter to Files.
- In the Options, set the Fields to All.
- Connect a Sort node to the output of the Google Drive node.
- Choose Simple sort type.
- Enter
modifiedTime
as the Field Name in the Fields To Sort By section. - Choose Descending sort order.
- Add a Limit node to the output of the Sort node.
- Set Max Items to 1 to keep the most recent file.
- Connect another Google Drive node to the output of the Limit node.
- Select File as the Resource and the operation of your choice.
- In the File selection, choose By ID.
- Select Expression and enter
{{ $json.id }}
as the expression.