# Redirect from within rule: context.request.body always empty

**URL:** <https://community.auth0.com/t/redirect-from-within-rule-context-request-body-always-empty/61084>\
**Category:** Get Help\
**Tags:** rules, redirect-rules\
**Created:** [April 14, 2021, 1:01pm UTC](https://community.auth0.com/t/redirect-from-within-rule-context-request-body-always-empty/61084 "2021-04-14T13:01:07Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![35c1b1d8](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/35c1b1d8/32/12805_2.png) [@35c1b1d8](https://community.auth0.com/u/35c1b1d8)\
**Post date:** [April 14, 2021, 1:01pm UTC](https://community.auth0.com/t/redirect-from-within-rule-context-request-body-always-empty/61084/1 "2021-04-14T13:01:07Z")

</div>

Hello,

A few months ago I followed [your guide](https://auth0.com/docs/rules/redirect-users) to setup a rule that redirects users to an external page, where they are required to perform an additional identity check before being allowed to login.

The rule worked flawlessy up until some days ago, when it suddently stopped working even tho absolutely nothing was changed.

After some debugging I was able to find out that the reason is the `context.request.body` field in the rule after the redirection to the `/continue` endpoint is always empty. Of course I verified that the POST request to the endpoint is correct and contains a JWT token in its body, but it seems like Auth0 cannot access the request body anymore.

Does anybody have any idea?

> **Rule code**
>
> ```javascript
> function(user, context, callback) {
> 
> const url = require('url@0.10.3');
> const req = context.request;
>   
> function createToken(user) {
> const options = {
> expiresIn: "5 minutes",
> notBefore: 0,
> audience: configuration["AUDIENCE"],
> issuer: configuration["ISSUER"],
> algorithm: "HS256"
> };
> return jwt.sign(user, configuration["SECRET"], options);
> }
>   
> function verifyToken(token) {
> const options = {
> audience: configuration["ISSUER"],
> issuer: configuration["AUDIENCE"],
> algorithms: ["HS256"]
> };
> const data = jwt.verify(token, configuration["SECRET"], options);
> if (data.jti !== user.jti) return false;
> if (data.sub !== user.user_id) return false;
> if (data.success !== true) return false;
> return true;
> }
>   
> if (user.additional_verification_required) {
> if (context.protocol === "redirect-callback") {
> var tokenIsValid = false;
> try {
> // ---> THIS FAILS BECAUSE req.body = {} <--- //
> tokenIsValid = verifyToken(req.body.token);
> } catch (exception) {
> return callback(new UnauthorizedError()); 
> }
> if (tokenIsValid === true) {
> return callback(null, user, context);
> } else {
> return callback(new UnauthorizedError());    
> }  
> } else {
> user.jti = uuid.v4();
> const token = createToken({
> sub: user.user_id,
> email: user.email,
> name: user.name,
> "jti": user.jti
> }
> );
>   
> context.redirect = {
> url: `https://example.com/callback?token=${token}`
> };
> }
> }
>     
> return callback(null, user, context);
> }
> 
> ```

> **POST request to the /continue endpoint**
>
> ```plaintext
> POST /continue?state=state_token_here HTTP/1.1
> Host: domain.eu.auth0.com
> Accept-Encoding: deflate, gzip
> User-Agent: user_agent_here
> Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
> Accept-Language: en-US;q=0.5,en;q=0.3
> Content-Type: application/x-www-form-urlencoded
> Origin: https://example.com
> DNT: 1
> Connection: keep-alive
> Referer: https://example.com
> Cookie: cookies_here
> Upgrade-Insecure-Requests: 1
> Sec-GPC: 1
> Pragma: no-cache
> Cache-Control: no-cache
> TE: Trailers
> Content-Length: 367
> 
> token=my_jwt_token_here
> 
> ```

---

<div class="post-metadata">

**Author:** ![info40](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/info40/32/12811_2.png) [@info40](https://community.auth0.com/u/info40)\
**Post date:** [April 14, 2021, 7:47pm UTC](https://community.auth0.com/t/redirect-from-within-rule-context-request-body-always-empty/61084/2 "2021-04-14T19:47:46Z")

</div>

I have absolutely the same issue, I have recognized it today, so the same is happening here: nothing is changed in code nor in auth0 setup.  
In our case we redirect the new users to a consent page, which then redirects back to `/continue` page, but since rule is failing to get anything from `context.request.body` (debugged with `Real-time Webtask Logs`), the rule is failing, so our new users cannot login at the moment.

---

<div class="post-metadata">

**Author:** ![kibble](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/kibble/32/13267_2.png) [@kibble](https://community.auth0.com/u/kibble)\
**Post date:** [April 15, 2021, 10:02am UTC](https://community.auth0.com/t/redirect-from-within-rule-context-request-body-always-empty/61084/3 "2021-04-15T10:02:55Z")

</div>

Exactly the same issue here. The ‘context.request.body’ is returning empty.

[https://auth0.com/docs/rules/context-object#:~:text=the%20body%20of%20the%20POST%20request%20on%20login%20transactions](https://auth0.com/docs/rules/context-object#:~:text=the%20body%20of%20the%20POST%20request%20on%20login%20transactions)

---

<div class="post-metadata">

**Author:** ![alex27](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/alex27/32/25334_2.png) [@alex27](https://community.auth0.com/u/alex27)\
**Post date:** [April 15, 2021, 10:13am UTC](https://community.auth0.com/t/redirect-from-within-rule-context-request-body-always-empty/61084/4 "2021-04-15T10:13:18Z")

</div>

Same, issue. It stopped working in our dev tenants that do not have custom domain set up, however same rule still works in prod tenants with custom domains.

---

<div class="post-metadata">

**Author:** ![Ale](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ale/32/50860_2.png) [@Ale](https://community.auth0.com/u/Ale)\
**Post date:** [April 15, 2021, 1:13pm UTC](https://community.auth0.com/t/redirect-from-within-rule-context-request-body-always-empty/61084/5 "2021-04-15T13:13:36Z")

</div>

Hi Community,

We are actively looking into this 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:** [April 15, 2021, 1:46pm UTC](https://community.auth0.com/t/redirect-from-within-rule-context-request-body-always-empty/61084/7 "2021-04-15T13:46:57Z")

</div>

We’ll give you updates as soon as we make significant progress in the investigation. Sorry for the inconvenience!

---

<div class="post-metadata">

**Author:** ![tiffany](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/tiffany/32/28821_2.png) [@tiffany](https://community.auth0.com/u/tiffany)\
**Post date:** [April 15, 2021, 3:27pm UTC](https://community.auth0.com/t/redirect-from-within-rule-context-request-body-always-empty/61084/8 "2021-04-15T15:27:22Z")

</div>

Hello Auth0, Any information yet? And will there be an update to the Status pages to understand which regions were/are affected?

---

<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:** [April 16, 2021, 11:14am UTC](https://community.auth0.com/t/redirect-from-within-rule-context-request-body-always-empty/61084/9 "2021-04-16T11:14:14Z")

</div>

Hey there!

The issue should be fixed for everyone now. Once more sorry for the inconvenience!

---

<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:** [April 23, 2021, 1:15pm UTC](https://community.auth0.com/t/redirect-from-within-rule-context-request-body-always-empty/61084/10 "2021-04-23T13:15:49Z")

</div>


