Auth - Passing Params to Helper

Is there any way to pass data to the helper file when running an authLogin action?

I am trying to conditionally route my users to a specific landing page based on which login button they click. It looks like the data model from the page does not get passed to the helper file in the onLogin hook. It also looks like I can’t put an object in the action and have those values passed to the helper file.

Is there any recommended or supported method to pass info to the helper file?

Yeah in the button add some data into the model with a function.

Then in the onLogin hook, you can pick it out!

Huh, I tried that and didn’t see the data model returned at all to the helper file. There’s not even a model key in the helper.

Here’s what I get back:

{
	"commonHookSetName" : "fieldtestapp",
	"data" : 
	{
		"query" : {},
		"state" : 
		{
			"domain" : "rapidscan.aelabs.com",
			"host" : "rapidscan.aelabs.com",
			"params" : 
			{
				"authentication" : 
				{
					"accessToken" : "xxxxx",
					"strategy" : "jwt"
				},
				"clientId" : "oKi1VontfTTF17JbAEjf",
				"handshake" : 
				{
					"address" : "::ffff:10.42.6.0",
					"headers" : 
					{
						"accept" : "*/*",
						"accept-encoding" : "gzip, deflate, br",
						"accept-language" : "en-US,en;q=0.5",
						"cache-control" : "no-cache",
						"connection" : "upgrade",
						"cookie" : "__zlcmid=16JkMrnRTkOJdZ0",
						"dnt" : "1",
						"host" : "rapidscan.aelabs.com",
						"origin" : "https://rapidscan.aelabs.com",
						"pragma" : "no-cache",
						"sec-fetch-dest" : "websocket",
						"sec-fetch-mode" : "websocket",
						"sec-fetch-site" : "same-origin",
						"sec-websocket-extensions" : "permessage-deflate",
						"sec-websocket-key" : "Ilmqx6z+XuXQLrWjEs70WA==",
						"sec-websocket-version" : "13",
						"upgrade" : "websocket",
						"user-agent" : "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:94.0) Gecko/20100101 Firefox/94.0",
						"x-forwarded-for" : "108.178.111.66",
						"x-forwarded-host" : "rapidscan.aelabs.com",
						"x-forwarded-port" : "443",
						"x-forwarded-proto" : "https",
						"x-original-uri" : "/socket.io/?EIO=3&transport=websocket",
						"x-real-ip" : "108.178.111.66",
						"x-request-id" : "529ebace545853b374257f33b49e02fc",
						"x-scheme" : "https"
					},
					"issued" : 1638825162042,
					"secure" : false,
					"xdomain" : true
				},
				"host" : "rapidscan.aelabs.com",
				"idLog" : 523,
				"provider" : "socketio",
				"query" : {},
				"route" : {},
				"user" : 
				{
					"auth0" : "",
					"auth0Id" : "",
					"avatar" : "https://s.gravatar.com/avatar/7c529106fb2bf079d1fc6a17dc405fa9?s=60",
					"createionTS" : "12/03/2021 15:01:54",
					"email" : "owen@aelabs.com",
					"id" : "xxxxx",
					"isEnabled" : 0,
					"isVerified" : 1,
					"loginRadiusId" : "",
					"loginRadiusProfile" : "",
					"modid" : 12,
					"modificationTS" : "12/06/2021 13:28:23",
					"recid" : 648,
					"resetExpires" : "",
					"resetShortToken" : "",
					"resetToken" : "",
					"status" : "",
					"verifyChanges" : "",
					"verifyExpires" : "",
					"verifyShortToken" : "",
					"verifyToken" : ""
				}
			},
			"server" : 
			{
				"dc" : "AWS-US-WEST-1",
				"gateway" : "XML",
				"version" : "0.10.43"
			},
			"subdomain" : "rapidscan"
		},
		"user" : 
		{
			"id" : "xxxxxx"
		}
	},
	"service" : "user.onLogin"
}

Hmm was certain the model was there.

Ok wel yo could use the query key then.

Ah great idea, that worked perfectly. Used JS to modify the URL when the button is clicked prior to calling the authLogin action. That passes the query along to the helper as you expected.

In case another user stumbles across this, here’s the JS I used

var currentURL = window.location.protocol + "//" + window.location.host + window.location.pathname + '#/login?goTo=manageAccount';

window.history.pushState({
    path: currentURL
}, '', currentURL);

@Owen Thanks for the snippet, it helps future travellers.