This is a guide on how to get one drive working using n8n on Proxmox. The reason why I’m sharing this is because I found it quite hard to find a guide on how to do this. There are many guides that show you how to do it when you run n8n on your local machine or on a cloud service like AWS, but not many that show you how to do it on Proxmox.
The problem that I was facing was that I could not get the OAuth2 authentication to work, because you need to have a redirect URI that is either accessible from the internet or you need to use a localhost redirect URI, but my n8n instance was running on Proxmox and was not accessible from the internet. So I needed to enter a redirect URI that was a local ip address, but that is not allowed by Microsoft. What is allowed is using a local ip adress if it has SSL enabled.
Step 1: Get n8n up and running on Proxmox Link to heading
Here you can find a script to get n8n up and running on Proxmox.
Step 2: Get SSL working on your n8n instance Link to heading
- Login to your n8n shell through proxmox or ssh
- Run the bash command below to generate a self signed certificate. You will be asked a few questions.
openssl req -x509 -nodes -newkey rsa:2048 -keyout n8n-key.pem -out n8n-cert.pem -days 365
- Run whichever terminal editor you like to edit the n8n configuration file which is located at
/opt/n8n.envif you used the script from step 1. - Add the following lines to the file:
N8N_SSL_KEY=/root/n8n-key.pem
N8N_SSL_CERT=/root/n8n-cert.pem
- Update the N8N_PROTOCOL to
https - Reboot the n8n instance
- You should now be able to access n8n using https://your-ip-address:5678
- You will get a warning in your browser because the certificate is self signed, but you can ignore that.
Step 3: Create an app in Azure portal Link to heading
- Go to the Azure portal
- Go to
Azure Active Directory->App registrations->New registration - Enter a name for your app e.g.
n8n - Select
Accounts in any organizational directory (Any Microsoft Entra ID tenant - Multitenant) and personal Microsoft accounts (e.g. Skype, Xbox) - Under
Redirect URIselectWeband enter your n8n instance url e.g.https://your-ip-address:5678/rest/oauth2-credential/callback - Click
Register - Go to
Certificates & secrets->New client secret - Enter a description e.g.
n8nand select your desired expiry time - Click
Add - Copy the value of the client secret, you will need it later
- Go to
API permissions->Add a permission->Microsoft Graph->Application permissions - Search for
Files.ReadWrite.Alland select it - Click
Add permissions - Click
Grant admin consent for {your organization}and confirm
Step 4: Configure n8n OneDrive credentials Link to heading
- Go to your n8n instance
- Go to
Credentials->New Credential->OneDrive OAuth2 API - Enter the following values:
- Client ID:
Application (client) IDfrom your app registration - Client Secret: The client secret value you copied earlier
- Client ID:
You should now be able to authenticate and use OneDrive in n8n.
Don’t forget to regenerate a new certificate every year or before it expires and to generate a new client secret in Azure portal before it expires.