0

Working on a Django/React app. I have some verification emails links that look like the following:

https://test.example.com/auth/security_questions/f=ru&i=101083&k=7014c315f3056243534741610545c8067d64d747a981de22fe75b78a03d16c92

In dev env this works fine, but now that I am getting it ready for production, it isn't working. When I click on it, it converts it to:

https://test.example.com/auth/security_questions/f%3Dru&i%3D101083&k%3D7014c315f3056243534741610545c8067d64d747a981de22fe75b78a03d16c92/

This prevents react-router-dom from matching the correct URL, so a portion of the web application does not load properly.

The link is constructed using the following.

link = '%s/auth/security_questions/f=%s&i=%s&k=%s' % \
('https://test.example.com', 'ru', user.id, user.key)

Also, here is the url() that is catching the route:

url(r'^(?:.*)/$', TemplateView.as_view(template_name='index.html')),
cjones
  • 8,384
  • 17
  • 81
  • 175

1 Answers1

2

These variables are supposed to be query parameters in a GET request. When you construct the link, you'll need to have a question mark in there somewhere separating the URL from the query string:

https://test.example.com/auth/security_questions/?f=ru&i=101083&k=7014c315...
                                                 ^
                                                 |___ here

The conversion of = to url-encoded %3D etc is correct, and equivalent. Sometimes variables are part of the URL directly, but webapps don't use &-separated key/value pairs in that case.

wim
  • 338,267
  • 99
  • 616
  • 750