# Android: Access custom error message from action access.deny

**URL:** <https://community.auth0.com/t/android-access-custom-error-message-from-action-access-deny/67756>\
**Category:** Get Help\
**Tags:** android\
**Created:** [August 11, 2021, 1:45pm UTC](https://community.auth0.com/t/android-access-custom-error-message-from-action-access-deny/67756 "2021-08-11T13:45:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Marius](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/marius/32/12206_2.png) [@Marius](https://community.auth0.com/u/Marius)\
**Post date:** [August 11, 2021, 1:45pm UTC](https://community.auth0.com/t/android-access-custom-error-message-from-action-access-deny/67756/1 "2021-08-11T13:45:52Z")

</div>

Greetings!

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:

> **[Auth0.Android Login, Logout, and User Profiles](https://auth0.com/docs/libraries/auth0-android/auth0-android-login-logout-and-user-profiles)**
>
> Learn how to add login, log out and read the user profile using the Android SDK.

```auto
  @Override
 public void onFailure(AuthenticationException exception) {
   // get the description
   exception.getDescription()

   // 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.

Thanks  
Marius

---

<div class="post-metadata">

**Author:** ![Marius](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/marius/32/12206_2.png) [@Marius](https://community.auth0.com/u/Marius)\
**Post date:** [August 11, 2021, 1:49pm UTC](https://community.auth0.com/t/android-access-custom-error-message-from-action-access-deny/67756/2 "2021-08-11T13:49:28Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [August 11, 2021, 2:55pm UTC](https://community.auth0.com/t/android-access-custom-error-message-from-action-access-deny/67756/3 "2021-08-11T14:55:47Z")

</div>

Perfect! Glad it’s working now!

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [August 26, 2021, 9:22am UTC](https://community.auth0.com/t/android-access-custom-error-message-from-action-access-deny/67756/4 "2021-08-26T09:22:48Z")

</div>


