Linking Reddit account leads to 401 error

Describe the problem/error/question

When trying to link a Reddit account, I receive a 401 error from n8n. The Reddit end appears to function though, as I receive a notification from Reddit that a new application have been linked.

What is the error message (if any)?

Error: 401
Failed to connect. The window can be closed now.

Misc

The oauth redirect URL is functional, I’ve used it to link to other APIs (Google, etc).

---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: n8n-server
  labels:
    app: n8n
spec:
  replicas: 1
  revisionHistoryLimit: 0
  strategy:
    type: Recreate
  selector:
    matchLabels:
      app: n8n
      tier: server
  template:
    metadata:
      labels:
        app: n8n
        tier: server
    spec:
      containers:
        - image: n8nio/n8n:0.223.0
          name: n8n-server
          envFrom:
            - configMapRef:
                name: n8n-env
          env:
            - name: DB_POSTGRESDB_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: n8n-secret
                  key: POSTGRES_PASSWORD
          ports:
            - containerPort: 5678
          volumeMounts:
            - name: n8n-vol
              mountPath: /home/node/
      dnsConfig:
        options:
          - name: ndots
            value: "1"
      volumes:
        - name: n8n-vol
          persistentVolumeClaim:
            claimName: n8n-pvc
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: n8n-env
data:
  DB_TYPE: postgresdb
  DB_POSTGRESDB_HOST: n8n-database
  DB_POSTGRESDB_PORT: '5432'
  DB_POSTGRESDB_DATABASE: n8n
  DB_POSTGRESDB_USER: n8n
  EXECUTIONS_DATA_MAX_AGE: '168'
  EXECUTIONS_DATA_PRUNE: 'true'
  EXECUTIONS_DATA_SAVE_MANUAL_EXECUTIONS: 'true'
  EXECUTIONS_DATA_SAVE_ON_SUCCESS: 'none'
  GENERIC_TIMEZONE: Asia/Tokyo
  N8N_BASIC_AUTH_ACTIVE: 'false'
  N8N_DIAGNOSTICS_ENABLED: 'false'
  N8N_HIRING_BANNER_ENABLED: 'false'
  N8N_HOST: n8n.tiuxo.com
  N8N_PORT: '5678'
  N8N_PROTOCOL: https
  NODE_ENV: production
  WEBHOOK_URL: https://n8n.example.com/

Information on your n8n setup

  • n8n version: 0.223.0
  • Database (default: SQLite): postgresql
  • n8n EXECUTIONS_PROCESS setting (default: own, main): own
  • Running n8n via (Docker, npm, n8n cloud, desktop app): kubernetes, official n8n docker image
  • Operating system: Rocky Linux 8.7

Hi @brianfclemens, n8n’s OAuth2 error handling can be a pain at times, so the error message isn’t helpful here. I am very sorry for this :frowning:

On the actual topic, I assume this about the Reddit credentials in n8n rather than generic OAuth2 credentials?

I’ve just created a fresh OAuth2 client on this Reddit page and could connect as expected:

Have you perhaps registered a different redirect URL with Reddit than what n8n displays in the credentials screen?

grafik

If not, could you inspect the redirect URL to see if it contains any URL parameter with error details? If successful, you’d see a state parameter as seen in my first screenshot, but if we’re lucky Reddit also passes back error information through URL parameters.

I’m not sure exactly what fixed it since there was nothing relevant in the changelog, but since upgrading to 0.225.1 it works :thinking:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.