Login with query param

Hi!
Im trying to pass a query param through my universal login page, I have this direct url to my login form: https://test.app.myapp/auth/login and i want to have something like, https://test.app.myapp/auth/login?param=1, but the redirect of auth0 remove that extra param

1 Like

Hi @hector.escalona,

Welcome to the Auth0 Community!

It may be possible to accomplish this by calling your custom param with the /authorize endpoint:

https://{yourDomain}/authorize?
    response_type=code&
    client_id={yourClientId}&
    redirect_uri={https://yourApp/callback}&
    scope={scope}&
    state={state}&
    param=1

Could you give it a try and see if this works?

Thanks,
Rueben

Hi Rouben, thanks for your reply!
Sadly, I still having the same issue, using the url that you just told me. I will try using a custom login to see is there is any diference.

Thanks!

Hi @hector.escalona,

Thank you for your reply.

After further testing, I found that this behavior is expected. After a successful login, the user is redirected to the callback URL with the state parameter.

Before going further, could you please clarify what you intend to do with the query parameter for login?

Could we attach this data to the user_metadata before login and perform the logic post-login?

Thanks,
Rueben

I am in a same situation, I would like to do something like Atlassian

https://id.atlassian.com/login?application=jira
https://id.atlassian.com/login?application=bitbucket

etc… so show different stuff based on the application. But I can’t find a way to pass some query parameter to the login page (I can pass state and query params to redirect_uri, but NOT on the login page which is where I need those.

HI @federico,

Are you abe to use the user_metadata instead of query parameters?

Thanks,
Rueben

@rueben.tiow

I used the extraParams from the loginWithRedirect for now but don’t know if it s the best.
Also, I will still need to support the query Parameters because for like invitation email or email redirecting to the login page, we want to show the proper app and those mail come without context as the user is not yet logged.

so we were hoping to just do like www.myapp.com?type=appA inside the email.

Hi @federico,

Could you please share which SDK you are using?

Also, here is a related post regarding how to pass extra parameters to the loginWithRedirect function, which you may find helpful:

Thanks, Rueben

Hi, I am using the JS version in react so @auth0/auth0-react /auth0-js

Yeah, so this is what I am using, I guess there are no way to alter query parameter ? it always need to be put into this config thing ?