Passing additional query string Universal Login url

Hi There

I am using the Custom Universal Login screen which is invoked from a React SPA application:

     const authFromHook = await createAuthClient({
        prompt: 'none',
        domain: AUTH_DOMAIN,
        client_id: AUTH_CLIENT_ID,
        audience: AUTH_AUDIENCE,
        redirect_uri: redirectUri,
      });
      setAuthClient(authFromHook);

I would like to pass an additional query parameter to the SignUp/Login page that would help my custom Universal page render the appropriate view. In this case, if the application has a “referralCode” then I’d like to render a Sign Up view, otherwise a Login view.

What would be the best way to achieve this?

Thanks ya’ll :slight_smile:

So it looks like login_hint seems to be passed through. However the documentation states that it "only affects the classic Lock experience. " → but is it oK to be used for this situation?

login_hint: string

Inherited from BaseLoginOptions.login_hint

* Defined in [src/global.ts:41](https://github.com/auth0/auth0-spa-js/blob/3a92890/src/global.ts#L41)

The user's email address or other identifier. When your app knows which user is trying to authenticate, you can provide this parameter to pre-fill the email box or select the right session for sign-in.

This currently only affects the classic Lock experience.

You can also pass extra parameters directly, and they will be available in the config.extraParams object.

John

1 Like

Could you explain me where to put these extra parameters?

Currently my team is using auth0-spa-js with Angular. We’re trying to pass one simple parameter that we can get into one rule and make some validation with it.

1 Like

you can pass additional parameters inside of loginWithRedirect(), right next to other configs. For example:

auth0.loginWithRedirect({
redirect_uri: window.location.href,
mycustomparameter: ‘hello123’
})

1 Like

Thanks for sharing that with the rest of community!

1 Like

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