Spotify only accepts https redirect url

I run n8n with npm on my local and using version 1.93.0
I have a spotify node and the callback url it gives me to paste to spotify is:
http://localhost:5678/rest/oauth2-credential/callback

However: Spotify doesn’t accept http redirect urls anymore and force me to enter https but obviously it returns a “invalid redirect url” error.

In spotify documentation: https://developer.spotify.com/documentation/web-api/concepts/redirect_uri it says that i can’t use localhost but 127.0.0.1 if i want to use http, I try it and it seems like it accept url until i write oauth2-credential portion as for some reason spotify doesn’t like dash “-” for url using http.

How i can overcome this problem?

If you have a registered domain name, or if you register a domain (typically from $20 to $50 per year), one way to do it is to use a subdomain for your n8n setup, and set up a reverse proxy like Traefik. Traefik can handle the SSL certificate part of it for you using LetsEncrypt. Also, you’ll probably need to use Docker to run Traefik and n8n.

I wrote up a tutorial for it if you want to try. Except for having a registered domain, the rest of it you can do cost-free.

Many hosting services where you can run n8n also handle the https part and you can use a subdomain that comes with the hosting account, but most of those options are arranged where you are either paying a bit or your resources are limited in some way.

Yes, also some people use ngrok, or temp domain but I wouldn’t recommend this, as mentioned using a actual domain is really cheap, Alot of people use traefik, I have to admit I prefer cloudflare tunnel, you can see brought guide here, I can explain more, but the tunnel is super easy and you get SSL through cloudflare, which a lot of providers use, avoid quite a few common problems I think.

I see some people using railway too, hosted in cloud but paying for usage I’ve used this one before but I don’t recommend if just doing dev stuff

This is my n8n yml I run with a few extras

version: '3.8'

volumes:
  db_storage:
  n8n_storage:
  redis_storage:
  pgadmin_data:
  prometheus_data:
  grafana_data:

x-shared: &shared
  restart: always
  image: docker.n8n.io/n8nio/n8n
  environment:
    - DB_TYPE=postgresdb
    - DB_POSTGRESDB_HOST=postgres
    - DB_POSTGRESDB_PORT=5432
    - DB_POSTGRESDB_DATABASE=${POSTGRES_DB}
    - DB_POSTGRESDB_USER=${POSTGRES_NON_ROOT_USER}
    - DB_POSTGRESDB_PASSWORD=${POSTGRES_NON_ROOT_PASSWORD}
    ##- EXECUTIONS_MODE=queue
    ##- QUEUE_MODE=redis
    ##- QUEUE_BULL_REDIS_HOST=redis
    ##- QUEUE_BULL_REDIS_PORT=6379
    ##- QUEUE_HEALTH_CHECK_ACTIVE=true
    - N8N_ENCRYPTION_KEY=${ENCRYPTION_KEY}
    - N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=true
    - N8N_HOST=localhost
    - N8N_PORT=5678
    - N8N_PROTOCOL=http
    - N8N_BASIC_AUTH_ACTIVE=true
    - N8N_BASIC_AUTH_USER=${N8N_USER}
    - N8N_BASIC_AUTH_PASSWORD=${N8N_PASSWORD}
    - N8N_LOG_OUTPUT=file
    - n8n.log.level=debug
    - N8N_METRICS=true
    - N8N_RUNNERS_ENABLED=true	
  links:
    - postgres
    - redis
  volumes:
    - n8n_storage:/home/node/.n8n
  depends_on:
    redis:
      condition: service_healthy
    postgres:
      condition: service_healthy

services:
  postgres:
    image: postgres:16
    restart: always
    environment:
      - POSTGRES_USER
      - POSTGRES_PASSWORD
      - POSTGRES_DB
      - POSTGRES_NON_ROOT_USER
      - POSTGRES_NON_ROOT_PASSWORD
    volumes:
      - db_storage:/var/lib/postgresql/data
      - ./init-data.sh:/docker-entrypoint-initdb.d/init-data.sh
    healthcheck:
      test: ['CMD-SHELL', 'pg_isready -h localhost -U ${POSTGRES_USER} -d ${POSTGRES_DB}']
      interval: 5s
      timeout: 5s
      retries: 10

  redis:
    image: redis:6-alpine
    restart: always
    volumes:
      - redis_storage:/data
    healthcheck:
      test: ['CMD', 'redis-cli', 'ping']
      interval: 5s
      timeout: 5s
      retries: 10

  n8n:
    <<: *shared
    ports:
      - 5678:5678
    user: root

  n8n-worker:
    <<: *shared
    command: worker
    depends_on:
      - n8n

  redisinsight:
    image: redislabs/redisinsight:1.14.0
    container_name: redisinsight
    ports:
      - "8001:8001"
    restart: always
    depends_on:
      redis:
        condition: service_healthy

  bull-board:
    build:
      context: .
      dockerfile: Dockerfile.bullboard
    container_name: bull-board
    ports:
      - "3002:3002"
    environment:
      - REDIS_HOST=redis
    depends_on:
      redis:
        condition: service_healthy

  pgadmin:
    image: dpage/pgadmin4
    container_name: pgadmin
    restart: always
    ports:
      - "5050:80"
    volumes:
      - pgadmin_data:/var/lib/pgadmin
    environment:
      PGADMIN_DEFAULT_EMAIL: [email protected]
      PGADMIN_DEFAULT_PASSWORD: admin
    depends_on:
      postgres:
        condition: service_healthy

  prometheus:
    image: prom/prometheus
    container_name: prometheus
    restart: always
    ports:
      - "9090:9090"
    volumes:
      - prometheus_data:/prometheus
      - ./prometheus.yml:/etc/prometheus/prometheus.yml
    command:
      - '--config.file=/etc/prometheus/prometheus.yml'
    depends_on:
      - n8n

  grafana:
    image: grafana/grafana
    container_name: grafana
    restart: always
    ports:
      - "3003:3000"
    volumes:
      - grafana_data:/var/lib/grafana
    environment:
      - GF_SECURITY_ADMIN_USER=admin
      - GF_SECURITY_ADMIN_PASSWORD=admin
    depends_on:
      - prometheus