Passing params from loginWithRedirect to the new Universal Login

Hello,

I have been searching for a solution to send some information over to the new universal login screen from my app. I’m using a React app that uses the @auth0/auth0-react hooks to login with redirect. I have tried passing values like so:

loginWithRedirect({ appState: { delegate: 'john@emailaddress.com' } })

and

loginWithRedirect({ delegate: 'john@emailaddress.com'  })

However, I’m not seeing delegate in the new universal config.

In my search, I have found many solutions for the classic universal login…just wondering if I’m doing it wrong or if it is a limitation of the new Universal Login.

Thanks!

Hi @justin7,

Welcome to the Community!

What are you wanting to do with the param after it is sent?

Hey Dan,

I was looking for a way to assign a user to a specific role during sign up. Opposed to using a hardcoded email pulled from my DB, I was thinking about just passing a delegate flag to the loginWithRedirect function call that would identify that the person creating an account should have administrative rights.

Does that make sense?

I’m not sure I completely understand. Wouldn’t any user be able to spoof a request from your app with the params and get admin privileges? Where are you keeping your list of admin?

Doing this via an API call or list in a rule would probably be more advisable. Are you assigning them a role in auth0? Like using the auth0 roles features?

Hey Dan - You’re right. That’s a bad example. I’m handling that piece on my server.

So could I pass a string of text that I could use to render a message dynamically to the customer? For example:

loginWithRedirect({ message: "Welcome to our App"})

This would then show up on the login screen of the new universal login…

For this type of flow you must use Classic Universal login.

Do you have a specific use-case for this that I could help work through?

Sure, thanks!

So the first usecase is that we are doing a lazy login/create account. We allow customers to search for the product they want and ask them to create an account (or log in if they are not already) during the “checkout” process. In this case, we just wanted to pass along some information regarding the product they purchased.

The second use-case is that there are 2 different audiences, one being a customer and the other being a provider of service and pending on which role you are in, I would like to have different messaging and fields in the create account experience.

Thanks for all of the help, Dan!

For this you can use a state param to keep track of what the user was doing when they left the app to go sign in.

For this, I would recommend passing a param as you described, then write a conditional statement in the Classic Universal Login customization page that changes the input options depending on the param you passed.

1 Like

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