Pass custom options to UniversalLogin (filled-in referal field)

Hi, we are trying to pass arbitrary values to Universal Login to fill a referral field and thus allow users to share referral links to our site.

The only param that fits the bill is “mode”, but we feel is a bit hacky to use that field for other purpose.

this.auth0.authorize({
appState: someParams, //ignored
language: language,
initialScreen: ‘signUp’,
translations: translations,
rememberLastLogin: true,

})

I’ve been looking to older posts and people talk about appState field, but we find that is ignored in UniversalLogin Login hosted page.

Are we missing something?

Thanks

You can use authParamsMap like this:


    webAuth.authorize({
      authParamsMap: {'referrerId': 'abc123'}
    });

and refer to it via config.extraParam.referrerId in the Universal Login Page (adding it as hidden additional field value) , or via context.request.query.auth_params_map.referrer_id in a Rule. The latter probably makes more sense.
You can then store the referrerId in the user’s metadata via a rule.

1 Like

Yup, that did it thanks, used a rule.

For future readers:

  • You can remove “appState” from the previous snippet

  • referrerId will show in rules as:

context.request.query.auth_params_map.referrer_id

@mathiasconradt please add this to the documentation because i was not able to find it and there are a lot of old stackoverflow answers, github issues, etc that are misleading.

Thanks!

Thanks for the info, I will adjust my answer, as I replied before just out of my head.

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