# Callback after Sign-up Not working

**URL:** <https://community.auth0.com/t/callback-after-sign-up-not-working/74265>\
**Category:** Get Help\
**Created:** [December 5, 2021, 2:13pm UTC](https://community.auth0.com/t/callback-after-sign-up-not-working/74265 "2021-12-05T14:13:14Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jonpawelko](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jonpawelko/32/33352_2.png) [@jonpawelko](https://community.auth0.com/u/jonpawelko)\
**Post date:** [December 5, 2021, 2:13pm UTC](https://community.auth0.com/t/callback-after-sign-up-not-working/74265/1 "2021-12-05T14:13:14Z")

</div>

The Callback from Auth0 after Sign-up is not working. I put the standard Callback and Logout URLs into the Settings as recommended in the demo app. Instead of Auth0 calling my /callback function or my localhost:3000 route… it seems to be calling the same Node JS Express route that called it. More specifically, I have a route in my Node Express application called /register Within /register it calls the Auth0 login function with screen\_hint: ‘signup’. This works fine, but after signing up, Auth0 calls my /register route in an infinite loop. It doesn’t call localhost:3000/callback (which I implemented) nor does it redirect to localhost:3000 like it does after login or logout. Any ideas?

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [December 7, 2021, 9:18pm UTC](https://community.auth0.com/t/callback-after-sign-up-not-working/74265/3 "2021-12-07T21:18:42Z")

</div>

Hi @jonpawelko,

Thanks for reaching out to the Auth0 Community!

I understand that your callback URL is not being called after a user goes through the sign-up flow.

> [@jonpawelko](#):
>
> Any ideas?

First, could you clarify whether the login flow redirects the user to the correct callback URL?

And, could you please clarify if you downloaded the sample app and followed the steps from our docs [here](https://auth0.com/docs/quickstart/webapp/nodejs)?

If you have done so, it should auto-populate the environment variables with the details from your application and you’ll only need to put the Allowed Callback URLs and Allowed Logout URLs in your application settings on the dashboard.

Lastly, you may find [this example](https://auth0.com/docs/quickstart/webapp/nodejs?download=true#adding-the-authentication-router) relevant in redirecting users to the callback URL.

Looking forward to your reply.

Thank you.

---

<div class="post-metadata">

**Author:** ![jonpawelko](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jonpawelko/32/33352_2.png) [@jonpawelko](https://community.auth0.com/u/jonpawelko)\
**Post date:** [December 8, 2021, 3:03pm UTC](https://community.auth0.com/t/callback-after-sign-up-not-working/74265/4 "2021-12-08T15:03:19Z")

</div>

**Hi Rueben! Thanks for the message. I have included my answers and some snippets below… Thanks!**

**I did follow the sample app and the steps you listed. I do have my allowed callback url set to [http://localhost:3000/callback](http://localhost:3000/callback) in my Auth0 account as shown in the sample. However, that callback function in my application never gets called. I looked at your sample as well and it looks like I’m following it as close as possible. I’m not using Passport, just Auth0. I think just about everything else works in my app including login and logout. Only the redirect from sign-up isn’t working.**

**I have the 2 code snippets in question pasted below. I first have a /register route in my application that gets called. That function then redirects the user to login with screen\_hit set to signup. This works fine, I get routed to Auth0 where I successfully sign up. I can see the new user added to Auth0 fine. It looks like the callback function I pasted below should get called, but instead, my /register route gets called again in an infinite loop. I have pasted my Node JS window text at the bottom below showing how the output looks. The browser just hangs.**

**// ----------------------------------------------**

**// This register function first gets called**

**router.get(‘/register’, function(req, res, next) {**

**console.log(“Before register”);**

**res.oidc.login({**

**authorizationParams: {**

**screen\_hint: ‘signup’,**

**},**

**});**

**console.log(“After register”);**

**});**

**// ----------------------------------------------------------**

**// Callback – this never gets called**

**router.get(‘/callback’, function(req, res, next) {**

**console.log(“Callback called!”);**

**if (req.oidc.isAuthenticated())**

**console.log("Email is " + req.oidc.user.email);**

**else {**

**console.log(“Not authenticated”);**

**}**

**res.render(‘index’, { title: ‘Express’ });**

**});**

**// ------------------------------------------------**

**Here is my Node JS cmd window output after I make the Register call, but before the callback is attempted:**

**C:\Users\jonpa\Documents\Software Engineering\Projects\Assassin 2022\Assassin Version 03\>npm start**

**\> assassinv01@0.0.0 start C:\Users\jonpa\Documents\Software Engineering\Projects\Assassin 2022\Assassin Version 03**

**\> node ./bin/www**

**Using ‘form\_post’ for response\_mode may cause issues for you logging in over http, see [express-openid-connect/FAQ.md at master · auth0/express-openid-connect · GitHub](https://github.com/auth0/express-openid-connect/blob/master/FAQ.md)**

**Connected…!**

**GET /assassin/ 200 18.348 ms - 1259**

**Before register**

**After register**

**GET /register 302 351.482 ms - 752**

* * *

**Here is my Node JS cmd window after I finish signing up on Auth0:**

**C:\Users\jonpa\Documents\Software Engineering\Projects\Assassin 2022\Assassin Version 03\>npm start**

**\> assassinv01@0.0.0 start C:\Users\jonpa\Documents\Software Engineering\Projects\Assassin 2022\Assassin Version 03**

**\> node ./bin/www**

**Using ‘form\_post’ for response\_mode may cause issues for you logging in over http, see [express-openid-connect/FAQ.md at master · auth0/express-openid-connect · GitHub](https://github.com/auth0/express-openid-connect/blob/master/FAQ.md)**

**Connected…!**

**GET /assassin/ 200 18.348 ms - 1259**

**Before register**

**After register**

**GET /register 302 351.482 ms - 752**

**Before register**

**After register**

**GET /register 302 10.421 ms - 752**

**Before register**

**After register**

**GET /register 302 9.281 ms - 752**

**Before register**

**After register**

**GET /register 302 5.391 ms - 752**

**Before register**

**After register**

**GET /register 302 7.049 ms - 752**

**Before register**

**After register**

**GET /register 302 5.324 ms - 752**

**Before register**

**After register**

**GET /register 302 7.294 ms - 752**

**Before register**

**After register**

**GET /register 302 5.509 ms - 752**

**Terminate batch job (Y/N)?**

---

<div class="post-metadata">

**Author:** ![jonpawelko](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jonpawelko/32/33352_2.png) [@jonpawelko](https://community.auth0.com/u/jonpawelko)\
**Post date:** [December 12, 2021, 12:17pm UTC](https://community.auth0.com/t/callback-after-sign-up-not-working/74265/5 "2021-12-12T12:17:15Z")

</div>

Hi Rueben. Good news! I think I figured out my issue.

I finally stumbled upon the login option properties defined on this express-openid-connect doc page: [https://auth0.github.io/express-openid-connect/interfaces/loginoptions.html#returnto](https://auth0.github.io/express-openid-connect/interfaces/loginoptions.html#returnto)

It appears I need to set the returnTo string when I call the res.oidc.login function. The documentation states that if I don’t set this, the URL to return to after login defaults to {@link Request.originalUrl}

That explains why my original calling URL keeps getting called in an infinite loop.

2 follow-up questions…

1. Is there a reason the Auth0 tutorial leaves out the returnTo parameter? Is my Application supposed to work without it like the Tutorial?
2. I still don’t understand why/how this is now working. I now have the returnTo set to /callback, same as I have set in my Auth0 Settings. Whether I login or register, I always return to my [http://localhost:3000/](http://localhost:3000/) route. I tried implementing the /callback function, but it never gets called. Is /callback a special route like /login or /logout that is already implemented under the covers? Why should I keep using /callback when I could just specify / or the actual route I want to end up at?

Updated code snippet:

res.oidc.login({  
returnTo: ‘/callback’,  
authorizationParams: {  
screen\_hint: ‘signup’  
},  
});

Thanks!  
Jon

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [December 13, 2021, 11:05pm UTC](https://community.auth0.com/t/callback-after-sign-up-not-working/74265/6 "2021-12-13T23:05:16Z")

</div>

Hi @jonpawelko,

Thank you for your responses.

Great catch on the `redirectTo` property! I’m happy to hear that you’ve addressed your infinite sign-up flow issue.

> [@jonpawelko](#):
>
> 1. Is there a reason the Auth0 tutorial leaves out the returnTo parameter? Is my Application supposed to work without it like the Tutorial?

The _returnTo_ parameter is optional. By default, downloading and using the Auth0 Express SDK quickstart will work OOTB. However, in your case of the sign-up loop, you needed to specify the `returnTo` property.

> [@jonpawelko](#):
>
> Is /callback a special route like /login or /logout that is already implemented under the covers? Why should I keep using /callback when I could just specify / or the actual route I want to end up at?

Yes, under the hood, it takes the _redirect\_uri_ value and validates it against the callback URL in your application settings.

When initiating the login flow, the _redirect\_uri_ request parameter is used as the callback URL. This is where your app receives and processes the response from Auth0 and redirects users to the callback URL after a successful login. Please take a look at our [OAuth 2.0 Authorization Framework](https://auth0.com/docs/authorization/protocols/protocol-oauth2) documentation that goes into details on how the _redirect\_uri_ works.

I hope this answers your questions!

Please let me know if there’s anything else I can do to help.

Thank you.

---

<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:** [December 28, 2021, 11:05pm UTC](https://community.auth0.com/t/callback-after-sign-up-not-working/74265/7 "2021-12-28T23:05:52Z")

</div>

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