I recently wrote an addon for my existing login system that allows users to login by simply clicking a link in an email. In the interests of security, I was keen that this link can only be used once. When it is sent to an email address it works exactly as intended. It logs the user in and they get "nag text" in the page header advising them they are using a one-click login and recommending they change their password.
During testing I had some people try it out and just sent them the link via SMS or Whatsapp. In both these examples, the login failed and they were presented with an error message I have written for use if the link had already been used.
It didn't just fail some of the time, it failed 100% of the time (consistency is great)
When a user clicks the link to login they send an 8-digit number (from the DB) and their username within the URL. The login script uses "get" to extract the values from the link. It then makes sure the right number is assigned to the ID before logging the user in. It then creates a new random number to prevent the link from working again.
The problem is prefetching. If the link is prefetched it is in effect a click and the number is updated. This means when the user clicks the link it is effectively the 2nd click and it will not work.
I am concerned that some email software may also do some form of prefetching of the link, triggering the update, thus rendering the link useless.
What would you suggest as a way of preventing the prefetch issue? In the real world, it will only ever be sent via email...
Mack.