Custom singup and login flow

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

Hi @pandeysumit832,

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

Did you read the doc I linked?

yeah also made a redirection rule

its working too but after that my application is stuck

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.

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

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.

adding subscription id

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?

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?

You could add it to the redirect request as a query param. Then in a rule, add that to the users app_metadata..

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

cool thanks man for ur help I appreciate that

1 Like

No problem! Let us know how it goes.

sure this solution is pretty much clear

1 Like

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

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”;

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

found this : Redirecting users from Rules 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.

1 Like

You found a solution right?

yeup, thanks for you help

1 Like