Android: Access custom error message from action access.deny


We are using the Auth0.Android SDK. When returning an error message via a Login-Action, we get a generic error message in the AuthenticationException Object, instead of the one returned in the action.

We catch the login failure the way it is described in the docs:

 public void onFailure(AuthenticationException exception) {
   // get the description

   // show it to the user

We previously had a Rule that checks if a user is verified. If not, we returned
return callback(new UnauthorizedError('our custom error message'));
This worked just fine. We got ‘our custom error message’ in the error description and could show it to the user.

Now we wanted to switch to Actions. Inside the action we return the error like this
api.access.deny('our custom error message');

But instead of our error message, the exception.getDescription() returns the generic error:

Permission were not granted. Try again.

What can we do, to display the error passed by api.access.deny() to the user?
In the logs everything looks fine, the error description is ‘our custom error message’. We also have a web app were the correct error message is shown and everything works fine.


Never mind, we just needed to update the SDK, now it seems to work :sweat_smile:

1 Like

Perfect! Glad it’s working now!