Hi,
I’ve seen in several posts (here and here for example) that it is possible to pass a custom parameter to a rule. However, my rule doesn’t receive the parameter. Has anything changed? Am I doing anything wrong?
Here is what I’m doing.
We use the Universal Login page (Classic experience, with Lock js).
In the template, I insert a custom parameter, here is an extract:
var params = config.internalOptions;
params.extra_param_test = "test";
console.log(params);
// Available Lock configuration options: https://auth0.com/docs/libraries/lock/v11/configuration
var lock = new Auth0Lock(config.clientID, config.auth0Domain, {
auth: {
redirectUrl: config.callbackURL,
responseType: (config.internalOptions || {}).response_type ||
(config.callbackOnLocationHash ? 'token' : 'code'),
params: params
},
Note that the console.log confirms that the extra_param_test is inserted.
When inspecting the context
object in a rule, the extra_param_test is not in the query object. Here is an extract:
"request": {
"userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:84.0) Gecko/20100101 Firefox/84.0",
"ip": "****",
"hostname": "sso.*****.com",
"query": {
"client_id": "******",
"audience": "https://sso.*****.com/api/v2",
"redirect_uri": "http://localhost:8080/",
"mode": "null",
"scope": "openid profile email offline_access",
"response_type": "code",
"response_mode": "web_message",
"state": "******",
"nonce": "*****",
"code_challenge": "******",
"code_challenge_method": "S256",
"prompt": "none",
"auth0Client": "****"
},
"body": {},
"geoip": {
Thanks for your help.
With best wishes,
Jeremy