Setting the Error Value Returned when Denying Access within Action via api.access.deny

Last Updated: Jul 10, 2024

Overview

This article explains whether it is possible to set the error value returned when denying access within an action via api.access.deny.

Applies To

  • API
  • Actions

Solution

It is not possible to do this. The error_description value returned will be the message passed to api.access.deny, but the error parameter will always have the value of access_denied, and the error code will be HTTP 500.

Sample code in Action:

api.access.deny(“Login failed.”);

The sample error response:

HTTP 500 {“error”:“access_denied”,“error_description”:“Login failed.”}

To suggest this functionality in a future release of Auth0, please submit a feature request using our Product Feedback form.