Documentation

n8n-nodes-unchained

This is an n8n community node package that provides Google and Microsoft service integrations with Supabase token authentication support.

Overview

This package extends n8n's built-in Google and Microsoft nodes with the ability to use OAuth tokens stored in Supabase, allowing you to manage authentication outside of n8n's credential system. This is particularly useful for multi-tenant applications or when you need to manage tokens programmatically.

Features

  • Supabase Token Authentication: Use OAuth tokens stored in your Supabase database
  • Multiple Authentication Methods: Support for OAuth2, Service Account, and Supabase tokens
  • Automatic Token Refresh: Tokens are automatically refreshed when expired
  • Provider Support: Google and Microsoft services

Installation

Follow the installation guide in the n8n community nodes documentation.

Available Nodes

Google Services

  • Gmail (Unchained) - Email management and automation with Supabase token support
  • Gmail Trigger (Unchained) - Trigger workflows on new emails with Supabase token support
  • Drive - Coming soon
  • Calendar - Coming soon

Microsoft Services

  • Outlook - Coming soon
  • OneDrive - Coming soon
  • Calendar - Coming soon

Credentials

Google Supabase Token

Configure your Supabase connection and Google OAuth credentials:

  • Supabase URL
  • Supabase Service Role Key
  • Google OAuth Client ID
  • Google OAuth Client Secret
  • Token Table Name (default: google_tokens)

Microsoft Supabase Token

Configure your Supabase connection and Microsoft OAuth credentials:

  • Supabase URL
  • Supabase Service Role Key
  • Microsoft Client ID (Azure AD Application ID)
  • Microsoft Client Secret
  • Tenant ID (default: common)
  • Token Table Name (default: microsoft_tokens)

Supabase Setup

Google Tokens Table

CREATE TABLE google_tokens (
  id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
  email TEXT NOT NULL UNIQUE,
  access_token TEXT NOT NULL,
  refresh_token TEXT NOT NULL,
  expires_at TIMESTAMP WITH TIME ZONE NOT NULL,
  created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
  updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()
);

CREATE INDEX idx_google_tokens_email ON google_tokens(email);

Microsoft Tokens Table

CREATE TABLE microsoft_tokens (
  id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
  email TEXT NOT NULL UNIQUE,
  access_token TEXT NOT NULL,
  refresh_token TEXT NOT NULL,
  expires_at TIMESTAMP WITH TIME ZONE NOT NULL,
  created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
  updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()
);

CREATE INDEX idx_microsoft_tokens_email ON microsoft_tokens(email);

Usage

  1. Set up your Supabase database with the token tables
  2. Store OAuth tokens in the appropriate table (google_tokens or microsoft_tokens)
  3. Create a Supabase credential in n8n (Google Supabase Token or Microsoft Supabase Token)
  4. Use the "Supabase Token" authentication method in your nodes
  5. Provide the user's email address to fetch the token from Supabase

Architecture

nodes/
├── Google/
│   ├── Gmail/          # Gmail nodes
│   ├── Drive/          # Coming soon
│   └── Calendar/       # Coming soon
├── Microsoft/
│   ├── Outlook/        # Coming soon
│   ├── OneDrive/       # Coming soon
│   └── Calendar/       # Coming soon
└── utils/
    └── supabaseAuth.ts # Shared authentication utilities

Resources

Version history

See CHANGELOG.md for version history and changes.

Discussion