Skip to main content

Setting up superset to be embedded in applications

Tutorial to Follow Along

Configuring superset to be embedded

  1. Install CORS dependency using pip install apache-superset[cors] Make Sure you are in Superset Python Environment.

  2. Go to superset config file i.e. superset_config.py and add following code.

        #Feature Flag 
    FEATURE_FLAGS =
    {
    "EMBEDDED_SUPERSET": True
    }

    # CORS Enabling
    ENABLE_CORS = True
    CORS_OPTIONS =
    {
    "supports_credentials": True,
    "allow_headers": "*",
    "expose_headers": "*",
    "resources": "*",
    "origins": ["http://localhost:4200","http://localhost:3000"] //4200 for angular , 3000 for react
    }


    # Dashboard embedding
    GUEST_ROLE_NAME = "Gamma"
    GUEST_TOKEN_JWT_SECRET = "PASTE_GENERATED_SECRET_HERE"
    GUEST_TOKEN_JWT_ALGO = "HS256"
    GUEST_TOKEN_HEADER_NAME = "X-GuestToken"
    GUEST_TOKEN_JWT_EXP_SECONDS = 300 # 5 minutes

    This will enable feature flag for embedding also cors be enabled with above configuration