# Actions: how to set the httpcode of the response?

**URL:** <https://community.auth0.com/t/actions-how-to-set-the-httpcode-of-the-response/100412>\
**Category:** Get Help\
**Tags:** other, missing-category\
**Created:** [February 13, 2023, 8:17pm UTC](https://community.auth0.com/t/actions-how-to-set-the-httpcode-of-the-response/100412 "2023-02-13T20:17:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bruno.crisafulli](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/bruno.crisafulli/32/44282_2.png) [@bruno.crisafulli](https://community.auth0.com/u/bruno.crisafulli)\
**Post date:** [February 13, 2023, 8:17pm UTC](https://community.auth0.com/t/actions-how-to-set-the-httpcode-of-the-response/100412/1 "2023-02-13T20:17:53Z")

</div>

Hello!  
I am trying to disallow `oauth/token` for users with unverified email, using the following Login/Post login **Action** :

```auto
exports.onExecutePostLogin = async (event, api) => {
  if (!event.user.email_verified) {
    api.access.deny(`Email verification needed.`);
  }
};

```

The problem is that now the endpoint returns an http code 500 and I cannot find how to change it

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [February 13, 2023, 8:41pm UTC](https://community.auth0.com/t/actions-how-to-set-the-httpcode-of-the-response/100412/3 "2023-02-13T20:41:02Z")

</div>

Hey there @bruno.crisafulli !

Unfortunately this isn’t currently possible, though I agree this would be nice. Please see the following post:

> [@Can't set the error code in an action](https://community.auth0.com/t/cant-set-the-error-code-in-an-action/78864/3):
>
> Hi @mattia.pettenuzzo , I’m afraid I could not find any evidence of this being currently worked on or planned. I would recommend raising this as a feedback request here: [Feedback](https://auth0.com/feedback) Until such a thing were implemented, I would recommend using the error description field to generate your application’s own error message, you could pass your own custom error codes for example or just look for the string, and have your application render the appropriate message based on the description, in the user’…

It might be worth adding your input to the following feedback request!

> [@Additional options for api.access.deny() in actions to trigger code on the backend](https://community.auth0.com/t/additional-options-for-api-access-deny-in-actions-to-trigger-code-on-the-backend/81607):
>
> Right now the default behavior is that the access.deny methods redirects the user to the default app where devoplers have to handle the error states. This behavior is totally fine. But it would be cool to have an option to have an additional paramater besides the one provided: success=false and error=message. I think something of something like an “errorCode”. Right now the only discriminator for handling error types in the tool is the error string itself. In my case I have multiple reasons …

Cheers,  
Ty

---

<div class="post-metadata">

**Author:** ![bruno.crisafulli](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/bruno.crisafulli/32/44282_2.png) [@bruno.crisafulli](https://community.auth0.com/u/bruno.crisafulli)\
**Post date:** [February 13, 2023, 9:07pm UTC](https://community.auth0.com/t/actions-how-to-set-the-httpcode-of-the-response/100412/4 "2023-02-13T21:07:03Z")

</div>

Ok thanks for answering. I voted and commented on the feedback request you linked.  
Cheers

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [February 27, 2023, 9:07pm UTC](https://community.auth0.com/t/actions-how-to-set-the-httpcode-of-the-response/100412/5 "2023-02-27T21:07:40Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
