n8n-nodes-google-form-auth
v1.0.5
Published
Google OAuth authentication for n8n forms
Maintainers
Readme
Add Goole authentication on you workflow forms
To use this community node, follow these steps.
Build a Workflow to Manage Google Authentication
This workflow will be the entry point for any workflow that requires Google authentication.
Create the First Webhook
Create a Webhook node with the following configuration:
- HTTP Method: GET
- Respond: Using a "Respond to Webhook" node
Create a Google OAuth Client
In Google Cloud Console:
- Create a new OAuth Client ID.
- Select Application Type: Web Application.
- Set Authorized JavaScript Origins to your n8n base url.
- Set Authorized Redirect URIs to your callback webhook URL.
- Download the JSON file containing the client configuration.
Install the Community Node
Go to:
Settings → Community Nodes → Install
Configure:
- npm Package Name:
n8n-nodes-google-form-auth - Check "I understand the risk..."
Create the Credentials
Go to the Credentials section in n8n and create a new credential:
Google OAuth Client JSON
Paste the contents of the JSON file downloaded from Google Cloud Console.
Configure the Authentication Flow
Add a Google Form Auth - Build Auth URL node.
Configure:
State
{{ $json.query.workflow }}Add a Respond to Webhook node and configure:
- Respond With: Redirect
Redirect URL
{{ $json.authUrl }}Create the Callback Webhook
In the same workflow, create a second Webhook node that is not connected to the previous nodes.
Configure:
- HTTP Method: GET
- Respond: Using a "Respond to Webhook" node
Connect it to a Respond to Webhook node and configure:
- Respond With: Redirect
Redirect URL
{{ $('redirect_uri').item.json.query.state }}&authorization_code={{ $json.query.code }}Workarounds
If your n8n instance is running behind a reverse proxy, it may be necessary to replace:
http://localhost:5678with your public n8n FQDN in the final redirect URL.
Build a Workflow That Requires Authentication
Now let's build an example workflow that requires users to authenticate with Google.
Create a Form
The workflow should begin with a Form node that contains a hidden field named:
authorization_codeExchange the Authorization Code
Add a Google Form Auth - Exchange Code node.
Configure:
Authorization Code
{{ $json.authorization_code }}Validate Authentication
Add an IF node to verify that an access token was received from Google:
{{ $json.access_token }}After successful authentication, Google will provide:
- Access token
- Email address
- Name
- Profile picture
You can use this information to route the workflow execution to subsequent steps. For example:
- Display a second form page requesting additional information.
- Allow access only to specific users.
- Display an authentication error page.
- Personalize the workflow experience.
How to Use These Workflows
If a user accesses the protected form URL directly, authentication will fail because the hidden authorization_code field will be empty.
Instead, users must start the authentication process using the first workflow's webhook URL and pass the protected form URL as the workflow parameter.
Example:
https://my-n8n.es/webhook/first-workflow?workflow=https://my-n8n.es/form/example_workflowAuthentication Flow
- The user opens the authentication workflow URL.
- The workflow redirects the user to Google.
- The user authenticates with Google.
- Google redirects the user back to the callback webhook.
- The callback webhook redirects the user to the protected form URL.
- The protected form receives the
authorization_code. - The workflow exchanges the authorization code for an access token.
- The user is authenticated and the workflow can continue.
