diff --git a/glare/api/middleware/keycloak_auth.py b/glare/api/middleware/keycloak_auth.py index 22844f1..4444e51 100644 --- a/glare/api/middleware/keycloak_auth.py +++ b/glare/api/middleware/keycloak_auth.py @@ -143,7 +143,7 @@ class KeycloakAuthMiddleware(base_middleware.Middleware): # Get user realm from parsed token # Format is "iss": "http://:/auth/realms/", __, __, realm_name = decoded['iss'].strip().rpartition('/realms/') - audience = decoded['aud'] + audience = decoded.get('aud') # Get roles from from parsed token roles = ','.join(decoded['realm_access']['roles']) \