Recent searches
No recent searches
Pre-filling ticket forms doesn't work well with logged out users and SSO
Posted Jun 22, 2022
We have links from our (non-zendesk) site to help our users create tickets on Zendesk, and these links will pre-fill certain parts of the ticket form to give additional useful context, using query string parameters as described here.
However, if the user is not logged into Zendesk then the redirect to authenticate will lose the query string parameters which pre-populate the form. This means the user gets a very slick sign-in experience, but ends up with an unexpectedly empty form.
So for example, if the link on our site takes the user to:
https://mycompany.zendesk.com/hc/en-us/requests/new?ticket_form_id=123&tf_1115745411613=something
Zendesk immediately redirects to:
https://mycompany.zendesk.com/hc/en-gb/restricted?return_to=https%3A%2F%2Fmycompany.zendesk.com%2Fhc%2Fen-gb%2Frequests%2Fnew%3Fticket_form_id%3D123
The next redirect is to our SSO sign-in page, however you can see it has already lost the `tf_1115745411613=something` query string parameter in the redirect to the `restricted` page. It remains missing all the way though the SSO process until the user is sent back to the original URL, which is now no longer exactly the original URL as it is missing query string parameters.
What I need is for the query string parameters to be preserved through the SSO process.
Is there a way to achieve this currently?
1
7 comments
Dane
You can check the workaround here by using JWT SSO.
0
James Thurley
Hi Dane,
Thanks for the link. As some of the comments in that thread suggest, the workaround doesn't actually address the issue: it suggests URL encoding the `return_to` parameter, but the `return_to` parameter in my scenario is created (and encoded) on Zendesk's side when it redirects from the new ticket form to the SSO flow. By the time it is received by our SSO logic, the key query string parameters have already been removed from the `return_to` URL by Zendesk.
However, Sam (who asked the question in that thread) made a key observation: it is only query string parameters starting with `tf_` which are being removed by Zendesk, and custom query string parameters are kept intact.
With this in mind I managed to create my own workaround:
When I generate a link to Zendesk, I take all the query string parameters and duplicate them, encoded, in a new custom query string parameter `form_parameters`. The original parameters still need to be there for the scenario when the user is already logged in to Zendesk.
So this, from my original question:
Becomes this:
When Zendesk generates the `return_to` parameter and passes it to our SSO service the `tf_1115745411613` parameter is lost but `form_parameters` parameter is not, so I simply replace the entire query string of the received `return_to` parameter with the decoded `form_parameters`.
This restores the URL to it's original state, and I can pass that restored URL back to Zendesk as the `return_to` parameter along with the JWT data.
In the following code you can use `createZendeskUrl` method when generating links to add the `form_parameters` query string parameter to a URL, and then use the `processRedirectUrl` during your SSO flow to restore the `return_to` URL to its original state using that parameter.
And some tests:
The big questions is, why is any of this necessary?
1
Alan
This seems like a Zendesk bug that the "tf_*" query parameters are lost. We'd prefer not to rely on this workaround - is this bug on Zendesk's backlog to fix?
0
Dane
We don't have any news on this one when I checked.
0
Gulzar Shikalgar
Hi Zendesk Team ,
Is there any bug or request feature tracking we can do for this issue ?
0
Sabra
This is a current, known limitation and we have since documented it here: Pre-filled ticket fields are removed after logging in with SSO.
I don't see a post in our Feedback pages requesting this type of functionality yet, so I highly encourage you to create a new post in the General Product Feedback topic!
0
Alan
I created one here.
0