Skip to content

[FAQ] pgAdmin: The CSRF session token is missing #126

@deedeepratiwi

Description

@deedeepratiwi

Course

data-engineering-zoomcamp

Question

How to solve 'The CSRF session token is missing. You need to refresh the page pgadmin' error on pgAdmin?

Answer

These steps can be used to resolve the "CSRF session token is missing" error in a pgAdmin Docker environment:
Immediate Browser Fixes

  • Refresh the page: A simple browser refresh (using F5, Ctrl+Shift+R, or Cmd+Shift+R) will often regenerate the cookies and a new CSRF token.
  • Clear browser cookies/cache: Old or corrupted cookies can cause the error. Clear the site's cookies and cached data in your browser's settings.
  • Use an Incognito/Private window

If that does not work, try adding these on the docker-compse.yaml:

  pgadmin:
    image: dpage/pgadmin4
    environment:
      - PGADMIN_DEFAULT_EMAIL=admin@admin.com
      - PGADMIN_DEFAULT_PASSWORD=root
      - PGADMIN_CONFIG_ENHANCED_COOKIE_PROTECTION=False
      - PGADMIN_CONFIG_WTF_CSRF_ENABLED=False
      - PGADMIN_CONFIG_WTF_CSRF_CHECK_DEFAULT=False
      - PGADMIN_CONFIG_SESSION_COOKIE_SAMESITE='Lax'
      - PGADMIN_CONFIG_SESSION_COOKIE_SECURE=False

Then run:

docker compose down -v
docker compose up -d --force-recreate

Checklist

  • I have searched existing FAQs and this question is not already answered
  • The answer provides accurate, helpful information
  • I have included any relevant code examples or links

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions