diff --git a/zerver/decorator.py b/zerver/decorator.py index e7efddbbf1..5344881d89 100644 --- a/zerver/decorator.py +++ b/zerver/decorator.py @@ -169,8 +169,13 @@ def authenticated_api_view(view_func): @require_post @has_request_variables @wraps(view_func) - def _wrapped_view_func(request, email=REQ, api_key=REQ('api-key'), + def _wrapped_view_func(request, email=REQ, api_key=REQ('api_key', default=None), + api_key_legacy=REQ('api-key', default=None), *args, **kwargs): + if not api_key and not api_key_legacy: + raise RequestVariableMissingError("api_key") + elif not api_key: + api_key = api_key_legacy user_profile = validate_api_key(email, api_key) request.user = user_profile request._email = user_profile.email