Custom login page using auth0-js => how to give to the callback url some data from the login page

Hi,

I’m using a custom login page, with the JS SDK auth0.
Our page is working fine, we use “WebAuth.prototype.login” to submit the credentials on the page.

But we have another field in our form, and we want to pass the value of this field to the callback url.

I tried to do it by adding it to the redirectUri as a query parameter:
this.auth0 = new auth0.WebAuth(config);
this.auth0.login({ email, passord, redirectUri: “http://mysite/callback?newParam=value”});

But I’m still redirected to http://mysite/callback … the query parameters are ignored ?

1 Like

Hey there @MLKiiwy, can you snag a HAR file of your current workflow when the param is supposed to be passed and direct message it over to me? I would like to see how it’s coming across because I’m not sure it should be but I want to verify. Please let me know if you have any questions, thank you.

Here is the HAR file: https://drive.google.com/file/d/1F9Xj8YlPhHOSLk1dN0Gh_audJsoQSBwl/view?usp=sharing

As you can see the call to https://usabilla-dev-1.eu.auth0.com/usernamepassword/login is done with redirect_uri: “http://console.usabilla.test:8888/callback?rememberMe=true” , but at the end the redirect goes to http://console.usabilla.test:8888/callback

You can not alter the redirect uri from the login page, by design and OAuth2 spec the value used for the callback MUST be the same as specified in the authorize call.

Ok, if we cannot change the redirectUri value, can we use something else to pass a variable/flag to the callback on the login phase?

Why I try to implement is a “remember me” feature, so I have a remember me checkbox on my custom login page.
I have to store this data somewhere to get it on my app and ask for renew the token.

1 Like

I wanted to follow up @MLKiiwy after looking into this a bit more I was able to find a previous referenced options by one of our team. Does this help you in your quest? If not please let me know what I can do to help facilitate a solution together, thanks!

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