Authentik [Solved] {“detail”: “Request denied due to expired/invalid license.”, “code”: “denied_license”}

The issue is described here:

https://github.com/goauthentik/authentik/issues/9051#issuecomment-2051505073

In short:

The issue was caused by a bug in 2024.2.1 which was fixed in 2024.2.2, but incorrect values could be cached and thus the warning banner/read only mode would wrongly be enabled.

The workaround is to remove the faulty cache item (cache.delete(CACHE_KEY_ENTERPRISE_LICENSE))

To fix:

Get into the shell (There are guides on how to do this depending on how you are running docker)

$ docker exec -it authentik-server-1 /bin/bash
$ ak shell
from django.core.cache import cache
from authentik.enterprise.license import LicenseKey, CACHE_KEY_ENTERPRISE_LICENSE
from authentik.enterprise.models import License
print(LicenseKey.get_total().summary())
print(cache.get(CACHE_KEY_ENTERPRISE_LICENSE))
print(License.objects.all().count())
import datetime
cache.set(CACHE_KEY_ENTERPRISE_LICENSE, {'internal_users': 0, 'external_users': 0, 'valid': False, 'show_admin_warning': False, 'show_user_warning': False, 'read_only': False, 'latest_valid': datetime.datetime(1970, 1, 1, 0, 0), 'has_license': False})
from authentik.enterprise.license import CACHE_KEY_ENTERPRISE_LICENSE
cache.delete(CACHE_KEY_ENTERPRISE_LICENSE)

After this, restart your container and you should be good to go! 😎


Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *