Magic link + next page parameter do not work

Hey there,

we have defined user group specific pages after signin in the standard app settings.

Additionally, we want to email in some scenarios magic deep links to our users which lead them to other pages than the standard pages after signin which we have defined for the different user groups.

Problem: The “magic link&next-page=/page-path” does not work anymore, i.e. all these magic links+next page URLs get redirected to the standard user-group specific page which we have defined as standard after signin.

Any idea how to change this?

Hi alexs and welcome to the Softr community!

Can you post an example link that uses the next-page querystring parameter that is not working? I am wondering if perhaps you’re using a & when you need to be using a ? in the URL.

1 Like

Thanks for taking this David.

Here comes the link: https://my.flipstaff.com/magic-authentication?magic-token=d26c24a18b4247899752347649672d05&next-page=/talentprofile?recordId=recoVWRxHyUJAJYeJ

@alexs thanks for sharing. I think this was conflicting with global redirect rules on user group level. We had an update 10 mins ago and I think this should be addressed. BTW would suggest DM-ing the magic links and not putting publicly here.

1 Like

yep, i had a lot of trust and have regenerated the link now;)

thanks for the update!

1 Like

Hello - I’m facing an issue with this url : https://myportal.org/magic-authentication?magic-token=REMOVED&next-page=/formulaire-rex-agriculteur?recordId=rechNETELMWl1Mbdj&peopleId=recRVdmciROv0e4GR

I want to redirect to a specific page and pass 2 parameters the record ID and the people ID, because these 2 fields are used to prefill a fillout form embed in the page.

Issue is that when it resolves the magic token, it redirect to the page but only keeps the first parameter
second is removed

Any idea on this ? Thanks in advance for your time

Hey @Flavien,

You need to encode the URL ( / - %3F | = - %3D | & - %26 ) it is the working version of the URL now

https://myportal.org/magic-authentication?magic-token=REMOVED&next-page=%2Fformulaire-rex-agriculteur%3FrecordId%3DrechNETELMWl1Mbdj%26peopleId%3DrecQM1RzxXBOWrDSf

Thanks,

2 Likes

Thanks @Suzie, this is really awesome. Solve the case, as always ! Thank you Softr team.
I share the piece of custom code in case someone else need this.
This was implemented as a “Run a script” task in an airtable automation.
Make sure to well declare your variables first to make it works. Enjoy

function customEncode(text) {
    return encodeURIComponent(text).replace(/%20/g, "+").replace(/%21/g, "!").replace(/%22/g, "\"").replace(/%23/g, "#").replace(/%24/g, "$").replace(/%26/g, "&").replace(/%27/g, "'").replace(/%28/g, "(").replace(/%29/g, ")").replace(/%2A/g, "*").replace(/%2B/g, "+");
}

let varliste = input.config();
console.log(varliste);

let magiclink = varliste.magiclink[0];
console.log(magiclink);

let pageurl = varliste.actionpageurl;
console.log(pageurl);

let rid = varliste.projectrecordid[0];
console.log(rid);

let peopleid = varliste.peopleID[0];
console.log(peopleid);

const redirecturl = pageurl + “?recordId=” + rid+ "&peopleId=" +peopleid;

var encodedURL = customEncode(redirecturl);
console.log(encodedURL);

const url = magiclink + "/&next-page=%2F" + encodedURL
console.log(url);

output.set('url', url);
1 Like

Also as a reference, if you need this magic link + next page + double url parameter inside a formula field in Airtable =>

Here I take the example of a magic link with the recordId of the user + a recordId of a project of the user. It can be anything else

{Magic link}&'&next-page=/yournextpage?recordId='&{RecordId (from Projects)}&'%26personId%3D'&RECORD_ID()

Magic link being the magic link field in the users table.

{RecordId (from Projects)} being the field of the recordId of a project of the user in the users table.

RECORD_ID() being the recordId of the user in the users table (the personId).

Hi @matthieu_chateau , plse excuse not terribly tech skilled user query re this topic. I have a block with some embedded code that enables me to call up a specific form and configure it using URL params e.g. www.webpage.com?formid=55&firstfield=YourName.

I have a Softr page to which certain user groups are directed on sign in by default using page rules. The page contains a custom code block called ‘formcode’, which includes my usual code for reading the params and launching the form process.

I would like the user on signing in with their magic link to go to this page and for a code specified in the url params to be displayed and configured eg by:

https://mysoftpage.com/magic-authentication?magic-token=ABCD1234&formid=44&firstfield=Welcome

I’ve tried escaping the & and the = etc but not having much luck. Would be hugely grateful for any tips!

VBW Steve

Hi Steve,

Can you take a screenshot of your formula field and show it here?

And tell me exactly what went wrong?