Skip to content

Delete Branding CSS in Authentik Docker Container

Authentik Delete Branding Hero

Sometimes you might want to remove custom CSS applied to your Authentik branding. This guide will show you how to do it by clearing the branding_custom_css field directly from the Authentik shell.

Understanding Where Custom CSS is Stored

The custom CSS is stored within the branding_custom_css field of your Authentik Brand object. By setting this field to an empty string, you effectively remove all custom CSS.


Steps to Delete Custom Branding CSS

Follow these steps to clear your custom branding CSS:

  1. Access the Authentik Shell:

    First, you need to open an interactive shell session within your Authentik Docker container. If you're using docker-compose, you can typically do this with:

    Bash
    docker-compose exec authentik sh
    

    Once inside the container, you'll need to run the Authentik shell:

    Bash
    ak shell
    
  2. Clear the branding_custom_css Field:

    Inside the Authentik shell, execute the following Python commands to retrieve your brand object and clear its custom CSS field:

    Python
    from authentik.brands.models import Brand
    
    brand = Brand.objects.first()
    brand.branding_custom_css = ""
    brand.save()
    
    • from authentik.brands.models import Brand: This line imports the Brand model, allowing you to interact with brand objects in your Authentik instance.
    • brand = Brand.objects.first(): This retrieves the first (and usually only) brand object defined in your Authentik instance.
    • brand.branding_custom_css = "": This sets the branding_custom_css field of the retrieved brand object to an empty string, effectively deleting any custom CSS.
    • brand.save(): This saves the changes made to the brand object back to the database.

After executing these commands, your custom branding CSS will be removed, and your Authentik instance will revert to its default styling or any other branding rules not related to branding_custom_css.