# Custom singup and login flow

**URL:** <https://community.auth0.com/t/custom-singup-and-login-flow/52459>\
**Category:** Get Help\
**Created:** [October 30, 2020, 11:13am UTC](https://community.auth0.com/t/custom-singup-and-login-flow/52459 "2020-10-30T11:13:14Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![pandeysumit832](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/pandeysumit832/32/24787_2.png) [@pandeysumit832](https://community.auth0.com/u/pandeysumit832)\
**Post date:** [October 30, 2020, 11:13am UTC](https://community.auth0.com/t/custom-singup-and-login-flow/52459/1 "2020-10-30T11:13:14Z")

</div>

I want to customize signup flow where I want to show form where user to fill in their credit card or debit card information as soon as they hit the signup or login button for the first time only

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [October 30, 2020, 9:02pm UTC](https://community.auth0.com/t/custom-singup-and-login-flow/52459/3 "2020-10-30T21:02:55Z")

</div>

Hi @pandeysumit832,

You can redirect the user from within a rule, only on first login. Checkout the doc on it:

> **[Redirect Users from Within Rules](https://auth0.com/docs/customize/rules/redirect-users)**
>
> Learn how to customize authentication flows by redirecting users using rules. Example areas that can be customized include MFA, privacy policy acceptance, and gathering user data.

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [November 4, 2020, 9:37pm UTC](https://community.auth0.com/t/custom-singup-and-login-flow/52459/5 "2020-11-04T21:37:40Z")

</div>

Did you read the doc I linked?

---

<div class="post-metadata">

**Author:** ![pandeysumit832](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/pandeysumit832/32/24787_2.png) [@pandeysumit832](https://community.auth0.com/u/pandeysumit832)\
**Post date:** [November 4, 2020, 9:40pm UTC](https://community.auth0.com/t/custom-singup-and-login-flow/52459/6 "2020-11-04T21:40:24Z")

</div>

yeah also made a redirection rule

---

<div class="post-metadata">

**Author:** ![pandeysumit832](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/pandeysumit832/32/24787_2.png) [@pandeysumit832](https://community.auth0.com/u/pandeysumit832)\
**Post date:** [November 4, 2020, 9:41pm UTC](https://community.auth0.com/t/custom-singup-and-login-flow/52459/7 "2020-11-04T21:41:06Z")

</div>

its working too but after that my application is stuck

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [November 4, 2020, 9:42pm UTC](https://community.auth0.com/t/custom-singup-and-login-flow/52459/8 "2020-11-04T21:42:06Z")

</div>

> After the redirect, resume authentication by redirecting the user to the `/continue` endpoint and include the `state` parameter you received in the URL. If you do not send the original state back to the `/continue` endpoint, Auth0 will lose the context of the login transaction and the user will not be able to log in due to an `invalid_request` error.

---

<div class="post-metadata">

**Author:** ![pandeysumit832](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/pandeysumit832/32/24787_2.png) [@pandeysumit832](https://community.auth0.com/u/pandeysumit832)\
**Post date:** [November 4, 2020, 9:50pm UTC](https://community.auth0.com/t/custom-singup-and-login-flow/52459/9 "2020-11-04T21:50:34Z")

</div>

can also send any other information using the link like adding a value to user meta?

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [November 4, 2020, 9:55pm UTC](https://community.auth0.com/t/custom-singup-and-login-flow/52459/10 "2020-11-04T21:55:21Z")

</div>

You could add data to user\_metadata in a rule. What type of information is it? Keep in mind that the user could manipulate this request.

---

<div class="post-metadata">

**Author:** ![pandeysumit832](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/pandeysumit832/32/24787_2.png) [@pandeysumit832](https://community.auth0.com/u/pandeysumit832)\
**Post date:** [November 4, 2020, 9:56pm UTC](https://community.auth0.com/t/custom-singup-and-login-flow/52459/11 "2020-11-04T21:56:57Z")

</div>

adding subscription id

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [November 4, 2020, 10:00pm UTC](https://community.auth0.com/t/custom-singup-and-login-flow/52459/12 "2020-11-04T22:00:32Z")

</div>

Okay, you will want to add that to app\_metadata, and probably don’t want to make that information available to the user to manipulate.

Are you doing this from a SPA or regular web app?

---

<div class="post-metadata">

**Author:** ![pandeysumit832](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/pandeysumit832/32/24787_2.png) [@pandeysumit832](https://community.auth0.com/u/pandeysumit832)\
**Post date:** [November 4, 2020, 10:01pm UTC](https://community.auth0.com/t/custom-singup-and-login-flow/52459/13 "2020-11-04T22:01:46Z")

</div>

yes, I m using react js  
As soon as i hit the create sub btn the sub id retuned from the payment process api how can i update it to app\_meta?

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [November 4, 2020, 10:11pm UTC](https://community.auth0.com/t/custom-singup-and-login-flow/52459/14 "2020-11-04T22:11:48Z")

</div>

You could add it to the redirect request as a query param. Then in a rule, [add that to the users app\_metadata.](https://auth0.com/docs/rules/metadata#update-app_metadata).

The query params from the /continue request should be available in the `context.request.query` object.

---

<div class="post-metadata">

**Author:** ![pandeysumit832](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/pandeysumit832/32/24787_2.png) [@pandeysumit832](https://community.auth0.com/u/pandeysumit832)\
**Post date:** [November 4, 2020, 10:13pm UTC](https://community.auth0.com/t/custom-singup-and-login-flow/52459/15 "2020-11-04T22:13:30Z")

</div>

cool thanks man for ur help I appreciate that

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [November 4, 2020, 10:14pm UTC](https://community.auth0.com/t/custom-singup-and-login-flow/52459/16 "2020-11-04T22:14:04Z")

</div>

No problem! Let us know how it goes.

---

<div class="post-metadata">

**Author:** ![pandeysumit832](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/pandeysumit832/32/24787_2.png) [@pandeysumit832](https://community.auth0.com/u/pandeysumit832)\
**Post date:** [November 4, 2020, 10:14pm UTC](https://community.auth0.com/t/custom-singup-and-login-flow/52459/17 "2020-11-04T22:14:34Z")

</div>

sure this solution is pretty much clear

---

<div class="post-metadata">

**Author:** ![pandeysumit832](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/pandeysumit832/32/24787_2.png) [@pandeysumit832](https://community.auth0.com/u/pandeysumit832)\
**Post date:** [November 5, 2020, 7:08am UTC](https://community.auth0.com/t/custom-singup-and-login-flow/52459/18 "2020-11-05T07:08:36Z")

</div>

When i m trying to continue the auth after the redirection rule its saying unauthorize

---

<div class="post-metadata">

**Author:** ![pandeysumit832](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/pandeysumit832/32/24787_2.png) [@pandeysumit832](https://community.auth0.com/u/pandeysumit832)\
**Post date:** [November 5, 2020, 7:10am UTC](https://community.auth0.com/t/custom-singup-and-login-flow/52459/19 "2020-11-05T07:10:47Z")

</div>

It was working when i tried it for the first time  
function (user, context, callback) {  
var loginCount = context.stats && context.stats.loginsCount ? context.stats.loginsCount : 0;  
var url = “[http://localhost:3000/plans](http://localhost:3000/plans)”;

if (loginCount \<= 1) {  
context.redirect = {url} ;  
}  
return callback(null, user, context);  
}  
here is the rule that i have written

---

<div class="post-metadata">

**Author:** ![pandeysumit832](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/pandeysumit832/32/24787_2.png) [@pandeysumit832](https://community.auth0.com/u/pandeysumit832)\
**Post date:** [November 5, 2020, 7:25am UTC](https://community.auth0.com/t/custom-singup-and-login-flow/52459/20 "2020-11-05T07:25:11Z")

</div>

found this : [Redirecting users from Rules](https://auth0.com/docs/rules/redirect) will not function properly. This is because redirect rules are resumed on the endpoint `https://YOUR_DOMAIN/continue` . When using Auth0’s developer keys, the session is established on a special endpoint that is generic and tenant agnostic, and calling `/continue` will not find your previous session, resulting in an error.

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [November 5, 2020, 8:56pm UTC](https://community.auth0.com/t/custom-singup-and-login-flow/52459/21 "2020-11-05T20:56:09Z")

</div>

You found a solution right?

---

<div class="post-metadata">

**Author:** ![pandeysumit832](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/pandeysumit832/32/24787_2.png) [@pandeysumit832](https://community.auth0.com/u/pandeysumit832)\
**Post date:** [November 5, 2020, 8:59pm UTC](https://community.auth0.com/t/custom-singup-and-login-flow/52459/22 "2020-11-05T20:59:39Z")

</div>

yeup, thanks for you help

[Next page](https://community.auth0.com/t/custom-singup-and-login-flow/52459.md?page=2)
